Here's my code first:
if userNameTextField.text != "" && userPasswordTextField.text != "" {
Auth.auth().signIn(withEmail: userNameTextField.text!, password: userPasswordTextField.text!, completion: { ( user, error ) in
if user != nil {
// Sing in Sucessful, then programmactically switch to tabbar view controller
self.performSegue(withIdentifier: "loginSuccessSegue", sender: self)
print("Success!")
}
else {
// Sign in unsuccessful
if let myError = error?.localizedDescription {
print(myError)
}
else{
print("Error")
}
}
}
)}
When I tested my app, even though the user is not regiestered and it printed out the error on my console, the button still performed the segue and changed my view in the success case (it performed 'loginSuccessSegue' even though the sign in is unsuccessful and went to the else loop)
I am wondering what did I do wrong here?
Thank you for your help in advance
Aucun commentaire:
Enregistrer un commentaire