maz
maz

Reputation: 397

Cannot convert value of type (PFUser!, NSError) void to expected argument type PFUserResultBlock

I am new to swift as well as programming but I am trying to retrieve check if a user can log in and I believe I did what Parse recommends to do to do so however I am receiving this error and am unsure as to why. Here is my code

 PFUser.logInWithUsernameInBackground(usernameTextField.text!, password: passwordTextField.text!){

            (user: PFUser!, error: NSError) -> Void in
            if user != nil {
                //Yes User Exists
                self.messageLabel.text = "User Exists"
            }
            else {
                //no user doesnt exist
            }
        }

Upvotes: 1

Views: 777

Answers (1)

Issamu
Issamu

Reputation: 46

I updated the xcode for version 8.1 and Parse started giving the same error.

I changed the call to the method to return to work. Here's how I did here:

PFUser.logInWithUsername (inbackground: usernameTextField.text !, password: passwordTextField.text !, block: {(user, error) in
  if user != nil {
    //Yes User Exists
    self.messageLabel.text = "User Exists"
  }
  else {
    //no user doesnt exist
  }
})

Upvotes: 1

Related Questions