Swift 4解析服务器云代码错误

时间:2018-07-24 20:27:24

标签: ios swift parse-server cloud-code

我只是复制并粘贴了文档中的示例代码

        // 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

0 个答案:

没有答案