gpt4 book ai didi

ios - Firebase 检查用户是否已经存在

转载 作者:行者123 更新时间:2023-11-28 09:53:50 26 4
gpt4 key购买 nike

我尝试运行以下命令,但它不起作用。如果用户已经使用过电子邮件,我在检查 Firebase 服务器时做错了什么?

           FIRAuth.auth()!.createUser(withEmail: self.userEmailTextField.text!, password: self.userPasswordTextField.text!) {(createUser, error) in
if error != nil {
FIRAuth.auth()!.signIn(withEmail: self.userEmailTextField.text!, password: self.userPasswordTextField.text!)

//Display logged in

let viewController = self.storyboard!.instantiateViewController(withIdentifier: "TabBarController") as UIViewController
self.present(viewController, animated: true, completion: nil)

}else {
//Display an alert message
self.displayMyAlertMessage(userMessage: "Email already in use. Please see the login page.")
return
}
}

最佳答案

请引用下面的代码。

代码:

FIRAuth.auth()?.createUser(withEmail: email, password: password) {
(user, error) in
if (error) {
// Email is already in use.
} else {
// Create new user successfully
}
}

Handle Firebase iOS Auth Errors

关于ios - Firebase 检查用户是否已经存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41091905/

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