I can't seem to find anything to fix this, searched all over the internet. Could somebody please explain to me how to fix this? :)
func refresh() {
var query:PFQuery = PFQuery(className: "Message")
query.findObjectsInBackgroundWithBlock { (objects:[AnyObject]?, error:NSError?) -> Void in
self.messagesArray = [String]()
if let objs = objects {
for messageObject in objs {
let messageText:String? = (messageObject as PFObject)["Text"] as? String >>>ERROR <<<
if messageText != nil {
self.messagesArray.append(messageText!)
}
}
}
self.messageTableView.reloadData()
}
}
答案 0 :(得分:2)
尝试:
let messageText:String? = messageObject.valueForKey("Text") as? String