@IBAction func login(_ sender: Any) {
guard emailField.text != "", passField.text != "" else {return}
Auth.auth().signIn(withEmail:emailField.text!,password:passField.text!, completion: { (user, error) in
if let error = error {
print(error.localizedDescription)
我收到此错误:
线程1:致命错误:在展开Optional值时意外发现nil。
答案 0 :(得分:0)
尝试:
guard let email = self.emailField.text, let password = self.passField.text else { return }
if email != "" && pass != "" {
Auth.auth().signIn(withEmail: email, password: password) { (user, err) in
if err != nil { print(err.localizedDescription); return }
// do something
}
}