ios - Function signature (NSError?) -> () is not compatible with expected type (error:NSError?) -> Void? -
![function signature (nserror?) -> ()
not compatible expected type(error:nserror?) -> void?]
is error keep receiving while trying build in xcode 6.4, error arises on self.follow "(user, completionhandler"
func signin(email:string, password:string) { pfuser.loginwithusernameinbackground(email, password: password) { (user: pfuser?, error: nserror?) -> void in if (user != nil) { var tabbarcontroller = tabbarcontroller() self.navigationcontroller?.pushviewcontroller(tabbarcontroller, animated: true) } else { println("sign in failure! alert user!") } } } func signup(email:string, password:string) { var user = pfuser() user.username = email user.email = email user.password = password user.signupinbackgroundwithblock { (succeeded: bool, error: nserror?) -> void in if error !== nil { self.follow(user, completionhandler: { (error) -> () in if error == nil { var tabbarcontroller = tabbarcontroller() self.navigationcontroller?.pushviewcontroller(tabbarcontroller, animated: true) } }) } else { println("sign failure! alert user!") } } } func follow(user: pfuser!, completionhandler:(error: nserror?) -> void?){ }
try unwrapping ?
add ! mark error this
self.follow(user, completionhandler: { (error!) -> () in
Comments
Post a Comment