[英]My swift code performs a segue when even if it shows that an error is occuring in the firebase login
This is my code, the first part (Auth.auth.signin) is authenticating with Firebase
if the emailId and password is correct. 这是我的代码,如果emailId和密码正确,则第一部分(Auth.auth.signin)正在使用
Firebase
身份验证。 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. 但是,即使不执行该代码,代码也可以执行
segue
。 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. 您已经完成了从按钮进行的segue。 Remove it and add Segue from View Controller to view controller.
删除它,并将Segue从View Controller添加到View Controller。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.