【发布时间】:2015-03-31 04:21:52
【问题描述】:
有没有办法使解析查询同步?我尝试将查询更改为 findObjects 而不是 findObjectsInBackgroundWithBlock。我似乎无法弄清楚它的语法。有人可以帮我解决这个问题吗?任何帮助表示赞赏。谢谢。
var messageQuery = PFQuery(className: "Message")
messageQuery.whereKey("GUID", equalTo: GUID)
messageQuery.findObjectsInBackgroundWithBlock {
(objects: [AnyObject]!, error: NSError!) -> Void in
if error == nil {
// The find succeeded.
println("Successfully retrieved \(objects.count) scores.")
// Do something with the found objects
if let objects = objects as? [PFObject] {
for object in objects {
println("in loop of objects retrieved")
object.delete()
}
}
messages.removeAtIndex(messageIndex)
//objectIDArr.removeAtIndex(messageIndex)
}else {
// Log details of the failure
println("Error: \(error) \(error.userInfo!)")
}
}
【问题讨论】:
标签: xcode swift asynchronous parse-platform synchronous