无法调用findObjectsInBackgroundWithBlock快速错误 [英] Cannot invoke findObjectsInBackgroundWithBlock swift error
本文介绍了无法调用findObjectsInBackgroundWithBlock快速错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
因此,在将所有用户都解析到我的应用程序时,我遇到了此错误:
So I ran into this error when getting all the users from parse to my application:
无法通过参数列表调用'findObjectsInBackgroundWithBlock' 类型为((([[AnyObject] !, NSError!)-> Void)'
Cannot invoke 'findObjectsInBackgroundWithBlock' with an argument list of type '(([AnyObject]!, NSError!) -> Void)'
尝试运行此代码:
var userQuery = PFUser.query()
userQuery.findObjectsInBackgroundWithBlock({(objects: [AnyObject]!, error: NSError!) -> Void in
self.users.removeAll(keepCapacity: true)
for object in objects {
var user:PFUser = object as PFUser
self.users.append(user.username)
}
self.tableView.reloadData()
})
我正在使用xcode 6.3,有什么解决方案吗?我尝试添加?"代替 "!"在[AnyObject]之后,但似乎无济于事.
I am using xcode 6.3, is there any solutions? I've tried adding "?" instead of "!" after [AnyObject] but nothing seems to help.
推荐答案
我实际上是通过执行这样的编码来使其工作的
I actually got it working with doing the coding like this
var data: Void? = query?.findObjectsInBackgroundWithBlock({(objects:[AnyObject]?, error:NSError?) -> Void in
self.users.removeAll(keepCapacity: true)
for object: AnyObject in objects! {
var user:PFUser = object as! PFUser
self.users.append(user.username!)
}
self.tableView.reloadData()
})
这篇关于无法调用findObjectsInBackgroundWithBlock快速错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文