ios - PFUser logInWithUsernameInBackground in Swift - Missing argument for parameter 'target' call -
i implementing login function parse written in swift. getting error:
missing argument parameter 'target' call
it doesn't seem i"m missing parameters though - i'm following declaration in pfuser.h.
here code:
//declarations @iboutlet weak var usernametextfield: uitextfield! @iboutlet weak var passwordtextfield: uitextfield! @ibaction func loginbuttonpressed(sender: uibutton) { let useremail = usernametextfield.text let userpassword = passwordtextfield.text //check both fields filled if usernametextfield != "" && passwordtextfield != "" { pfuser.loginwithusernameinbackground(useremail, password: userpassword) { (user: pfuser, error: nserror) -> void in { } }
thank help!
you have curly braces , username , password checks wrong. try below code (copy & paste please) works:
@ibaction func loginbuttonpressed(sender: uibutton) { let useremail = usernametextfield.text let userpassword = passwordtextfield.text if !useremail.isempty && !userpassword.isempty { pfuser.loginwithusernameinbackground(useremail, password: userpassword) { (user, error) -> void in if error == nil { println("succesful") } else { println("error: \(error!.userinfo!)") } } } }
Comments
Post a Comment