我只是复制并粘贴了文档中的示例代码
// Swift
PFCloud.callFunctionInBackground("averageRatings", withParameters: ["movie":"The Matrix"]) {
(response: AnyObject?, error: NSError?) -> Void in
let ratings = response as? Float
// ratings is 4.5
}
我从Xcode收到以下错误
Cannot convert value of type '(AnyObject?, NSError?) -> Void' to expected argument type 'PFIdResultBlock?' (aka 'Optional<(Optional<Any>, Optional<Error>) -> ()>')
Insert ' as! PFIdResultBlock'
如果我单击“修复”并插入as! PFIdResultBlock
,错误仍然存在,并且仍然说要添加as! PFIdResultBlock