xcodeswiftparse-platformxcode6.3.1

SWIFT + Parse signUpInBackgroundWithBlock no longer works: Xcode 6.3.1


I'm using the latest parse code from the parse.com for user.signupInBackgroundWithBlock

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)
            }

I just upgraded to x-code 6.3.1 and it no longer works. This is copied directly from Parse.com, but I'm getting an error on the user.signUp line:

1.0/SIgnUpViewController.swift:48:46: Function signature '(Bool?, NSError?) -> Void' is not compatible with expected type

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

any tips?


Solution

  • have you tried it without the "?" after the Bool

    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) }