gpt4 book ai didi

ios - 用户不会显示在 Firebase 的“身份验证”选项卡上

转载 作者:行者123 更新时间:2023-11-30 12:25:12 25 4
gpt4 key购买 nike

为什么当我输入电子邮件和密码时,Firebase 中没有显示任何内容?我以前做过,没有任何问题。

当我在 firebase 中检查“身份验证”选项卡时,未进行任何用户输入。

//Sign up user
let email = emailTextField.text
let password = passwordTextField.text

FIRAuth.auth()?.createUser(withEmail:email! , password: password!, completion: { (user, error) in
if error != nil {
self.login()
} else {
print("User created!")
self.login()
}
})

}

@IBAction func signInButton(_ sender: Any) {

}

//Functions
func login(){
FIRAuth.auth()?.signIn(withEmail: emailTextField.text!, password: passwordTextField.text!, completion: { (user, error) in

if error != nil {
print("Password or email has not been entered correctly")
} else {
print("Successful Login")
}

})
}



}

最佳答案

我不知道它是否能解决您的问题,但请尝试使用防护声明进行声明,并在注册/登录中删除刘海(!)。它至少应该大大减少出错的可能性。

Guard let email = emailTextField.text else { return }
Guard let password = passwordTextField.text else { return }

现在去掉刘海,看起来像这样

FIRAuth.auth()?.createUser(withEmail: email , password: password, completion: { (user, error) in

对您的登录功能执行相同的操作,使用保护语句解开您的 textField 文本。

干杯。

关于ios - 用户不会显示在 Firebase 的“身份验证”选项卡上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44297108/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com