ios – 解析SDK方法不适用于Xcode 6.3 Beta

到目前为止,我遇到了像这样的块的问题:
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.
        }
    }

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

Cannot invoke 'signUpInBackgroundWithBlock' with an argument list of type '((Bool!,NSError!) -> Void)'

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

解决方法

确保您使用的是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.
    }
}

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...