gpt4 book ai didi

ios - 尝试在 Parse 中查询对象

转载 作者:行者123 更新时间:2023-11-28 08:54:46 25 4
gpt4 key购买 nike

query.findObjectsInBackgroundWithBlock { (objects:[AnyObject]?, error:NSError?) -> Void in

if error == nil {
if let objects = objects as? [PFObject] {
for object in objects {
print("woot")
}
}

} else {
// Log details of the failure
print("Error: \(error) \(error!.userInfo)")
}
dispatch_async(dispatch_get_main_queue()){
//reload the table view

query.cachePolicy = PFCachePolicy.NetworkElseCache
}

}

出于某种原因,该行:

query.findObjectsInBackgroundWithBlock { (objects:[AnyObject]?, error:NSError?) -> Void in

给我错误:

Cannot convert value of type '([AnyObject]?, NSError?) -> void to expected argument type 'PFQueryArrayResultBlock?'

我不知道如何修复错误。

谢谢!

最佳答案

结果 block 应该如下所示:

query.findObjectsInBackgroundWithBlock {
(objects: [PFObject]?, error: NSError?) -> Void in

if error == nil {
if let objects = objects as? [PFObject] {
for object in objects {
print("woot")
}
}

} else {
// Log details of the failure
print("Error: \(error) \(error!.userInfo)")
}
dispatch_async(dispatch_get_main_queue()){
//reload the table view

query.cachePolicy = PFCachePolicy.NetworkElseCache
}
}

参见 Parse docs关于查询。

关于ios - 尝试在 Parse 中查询对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33375814/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com