SWIFT + 解析 signUpInBackgroundWithBlock 不再有效:Xcode 6.3.1

SWIFT + Parse signUpInBackgroundWithBlock no longer works: Xcode 6.3.1

我正在为 user.signupInBackgroundWithBlock

使用 parse.com 的最新解析代码
user.signUpInBackgroundWithBlock {
            (succeeded: Bool?, error: NSError?) -> Void in
            if let error = error {
                let errorString = error.userInfo?["error"] as? NSString
               self.showAlertWithText(message: "\(error)")
            } else {
                self.performSegueWithIdentifier("createNewUserAndGoToDashboard", sender: self)
            }

我刚刚升级到 x-code 6.3.1,但它不再有效了。这是直接从 Parse.com 复制的,但我在 user.signUp 行收到错误:

1.0/SIgnUpViewController.swift:48:46:函数签名 '(Bool?, NSError?) -> Void' 与预期类型

不兼容
'@objc_block (Bool, NSError!) -> Void'

有什么建议吗?

你试过没有“?”吗?书后

user.signUpInBackgroundWithBlock {
            (succeeded: Bool, error: NSError?) -> Void in
            if let error = error {
                let errorString = error.userInfo?["error"] as? NSString
                self.showAlertWithText(message: "\(error)")
            } else {
                self.performSegueWithIdentifier("createNewUserAndGoToDashboard", sender: self) }

试试这个。

user.signUpInBackgroundWithBlock { (returnedResult, returnedError) -> Void in
        if returnedError == nil
        {
            self.dismissViewControllerAnimated(true, completion: nil)
        }
        else
        {
            self.showAlert("There was an error with your sign up", error: returnedError!)
        }
    }