我正在尝试运行查询以获取ID为背景的对象,但是当我运行方法query.getObjectInBackgroundWithId
时,出现了错误消息:
"Cannot invoke 'getObjectInBackgroundWithId' with an argument list of type (string, block: (PFObject!,NSError?) -> Void"
当我使用user.signUpInBackgroundWithBlock
时会发生相同的事情,所以我在想也许Xcode在使用'block'时更新了某些功能,现在语法可能有所不同吗?有什么想法吗?
这是我的代码段:
是!谢谢!
getObject的新示例代码是:
query.getObjectInBackgroundWithId("Oaq79bhv53") {
(gameScore: PFObject?, error: NSError?) -> Void in
if error == nil && gameScore != nil {
println(gameScore)
} else {
println("error")
}
}
我知道了!
user.signUpInBackgroundWithBlock{(succeeded: Bool, signUpError: NSError?) -> Void in
Swift 4.2:
query.getObjectInBackground(withId: "YourId") { (gameScore, error) in
if error == nil {
// Success!
print(gameScore)
} else {
// Fail!
}
}