ios - Swift Parse create a user -
i'm new swift, , i'm having difficult time figuring out why code on https://www.parse.com/docs/ios_guide#users/ios isn't working me
var user = pfuser() user.username = "myusername" user.password = "mypassword" user.email = "email@example.com" // other fields can set pfobject user["phone"] = "415-392-0202" user.signupinbackgroundwithblock { (succeeded: bool!, error: nserror!) -> void in if error == nil { // hooray! let them use app now. } else { let errorstring = error.userinfo["error"] nsstring // show errorstring somewhere , let user try again. } } this line
user.signupinbackgroundwithblock gives me following error
cannot invoke 'signupinbackgroundwithblock' argument list of type '((bool!, nserror!) -> void)' i can copy , paste code objective-c project , works perfectly, when try same swift code. error message. there else need work in swift?
i found solution in case others having similar problem. code below seems working fine. i'm curious know why parse.com gives above code in documentation doesn't work
user.signupinbackgroundwithblock { (succeeded: bool, error: nserror?) -> void in if error == nil { // hooray! let them use app now. } else { } }
Comments
Post a Comment