【发布时间】:2018-04-06 16:59:54
【问题描述】:
我在更新 firebase 后尝试登录我的用户,在跟踪错误后,我收到以下错误:
Error Domain=FIRAuthErrorDomain Code=17007 "电子邮件地址是 已被另一个帐户使用。” UserInfo={NSLocalizedDescription=电子邮件地址已被使用 由另一个帐户。,error_name=ERROR_EMAIL_ALREADY_IN_USE}
看起来似乎是因为该 firebase 用户已经在使用中,我不知道如何解决这个问题。我相信这是因为我在关闭应用程序之前从未退出过用户,但不是无法以我的任何用户身份登录。
下面是我的代码:
@IBAction func Login(sender: AnyObject) {
let email = self._Email.text!
let password = self._Password.text!
Auth.auth().createUser(withEmail: email, password: password) { (user, error) in
if error == nil {
//successfull login
print("Successful login****************************************")
//performs a segue to the next view controller
if user!.isEmailVerified{
//if the email is verified
let vc = self.storyboard!.instantiateViewController(withIdentifier: "ProfileView") as! ProfileView
self.present(vc, animated: true, completion: nil)
}
else {
print("email is not verified")
}
} else {
print("Some login error")
}
}
}
【问题讨论】:
-
您正在使用
createUser登录!此功能旨在用于注册新用户而不是用于登录。而是使用此Auth.auth().signIn(withEmail: email, password: password)
标签: ios swift firebase firebase-authentication