解析SDK方法在Xcode 6.3 Beta中不起作用

Jas*_*rey 7 xcode ios parse-platform

到目前为止,我遇到了像这样的块的问题:

user.signUpInBackgroundWithBlock {
        (succeeded: Bool!, error: NSError!) -> Void in
        if error == nil {
            println("success")
        } else {
            println("\(error)");
            // Show the errorString somewhere and let the user try again.
        }
    }
Run Code Online (Sandbox Code Playgroud)

当我将其添加到Xcode中时,我得到了这个:

Cannot invoke 'signUpInBackgroundWithBlock' with an argument list of type '((Bool!, NSError!) -> Void)'
Run Code Online (Sandbox Code Playgroud)

当我在Xcode 6.3(非beta)中运行此代码时,它工作正常.但在测试版中,它失败了,不允许我构建.任何想法,如果这将被清除或如果有我可以使用的不同实现.香港专业教育学院曾尝试使用signUpInBackgroundWithTarget但我只是无法正确访问错误,如果收到错误.

wfb*_*ale 9

确保您使用的是SDK版本1.7.1,然后从闭包中删除类型应该可以解决问题:

user.signUpInBackgroundWithBlock { (succeeded, error) -> Void in
    if error == nil {
        println("success")
    } else {
        println("\(error)");
        // Show the errorString somewhere and let the user try again.
    }
}
Run Code Online (Sandbox Code Playgroud)


nic*_*999 0

您使用的是哪个解析 SDK?他们几天前发布了 1.7.1 版本,应该可以解决您的问题。