2016年2月25日 星期四

leancloud query, call back , get value


        let query: AVQuery = AVQuery(className: "story")
        query.whereKey("objectId", equalTo: "56c6f8362e958a0059fcd854")
        query.includeKey("question")
        
        
        query.findObjectsInBackgroundWithBlock({(objects: [AnyObject]?, error: NSError?) in
            
            let obj: AVObject = objects![0] as! AVObject
            let q: AVObject = obj["question"] as! AVObject
            
            self.studentLabel?.text = String(obj["name"])
            self.idLabel?.text = String(obj["object"])
            self.questionLabel?.text = String(q["name"])        
        })

沒有留言:

張貼留言