ニフティクラウドmobile backendのmbaasを使いデータストアのクラスのデータを全件検索することができました。
参考:https://qiita.com/natsumo/items/cffdc5f6933988916600
検索した結果をTableViewに表示させたいのですが、どうすればいいでしょうか。
配列がJSONの文字列なのでまず値を格納してからとかなのでしょうが、どう格納すればいいか調べてみましたがわかりませんでした。
どなたかご教示のほどよろしくお願いします。
swift
1import UIKit 2import NCMB 3 4class ViewController: UIViewController { 5 6 override func viewDidLoad() { 7 super.viewDidLoad() 8 9 // TestClassクラスを検索するNCMBQueryを作成 10 let query = NCMBQuery(className: "Test") 11 12 /** 条件を入れる場合はここに書きます **/ 13 14 // データストアの検索を実施 15 query?.findObjectsInBackground({(objects, error) in 16 if (error != nil){ 17 // 検索失敗時の処理 18 }else{ 19 // 検索成功時の処理 20 print(objects! as! [NCMBObject]) // (例)検索結果を表示する 21 } 22 23 } 24 25 override func didReceiveMemoryWarning() { 26 super.didReceiveMemoryWarning() 27 // Dispose of any resources that can be recreated. 28 } 29}
あなたの回答
tips
プレビュー