This is my code, the first part (Auth.auth.signin) is authenticating with Firebase
if the emailId and password is correct. After that, if incorrect, it print incorrect. This part does show up in the console. However, the code performs the segue
even though it is not supposed to. Why is this?
@IBAction func loginPressed(_ sender: Any) {
//TODO: Log in the user
Auth.auth().signIn(withEmail: emailTextfield.text!, password: passwordTextfield.text!) { (user, error) in
print(error!)
if(error != nil || user == nil){
print("incorrect signin")
}
else{
self.performSegue(withIdentifier: "goToChat", sender: self)
print("Login was good")
}
}
}
You have done segue from your button. Remove it and add Segue from View Controller to view controller.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.