gpt4 book ai didi

swift - UserInfo={NSLocalizedDescription=该电子邮件地址已被其他帐户使用。, error_name=ERROR_EMAIL_ALREADY_IN_USE}

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

嘿伙计们,实际上我在这里尝试两件事:-尝试创建一个新帐户并尝试打开一个类似于登录后出现的屏幕,但它显示“电子邮件已存在错误”。

@IBAction func CreateAcccountButton(_ 发送者: AnyObject) {

guard  let eventInterest = textBox.text,let email = EmailTestfield.text, let password = PasswordTestfield.text, let name = UsernameTestfield.text   else {
print("Form is not valid")
return
}

Auth.auth().createUser(withEmail: 电子邮件,密码:密码,完成:{ (用户,错误) in

    if let error = error {
print(error)
return
}

guard let uid = user?.uid else {
return
}

//successfully authenticated user
let imageName = UUID().uuidString
let storageRef = Storage.storage().reference().child("profile_images").child("\(imageName).png")

if let uploadData = UIImagePNGRepresentation(self.Profilepicture.image!) {
storageRef.putData(uploadData, metadata: nil, completion: { (metadata, error) in

if let error = error {
print(error)
return
}
print (metadata)
// let downloadURL = metadata?.downloadURL()
// print("URL ", downloadURL)

if let Profilepictureurl = metadata?.downloadURL()?.absoluteString {
let values = ["name": name, "email": email,"EventInterest":eventInterest,"Password":password,"Profilepictureurl": Profilepictureurl ]
let user = User(dictionary: values as [String : AnyObject])
let customViewController = MessagesController()
customViewController.setupNavBarWithUser(user)
customViewController.fetchUserAndSetupNavBarTitle()
// customViewController.navigationItem.title = values["name"] as? String
self.dismiss(animated: true, completion: nil)
self.registeruserintoDb(uid,values: values as [String : AnyObject])


}
})
}
}
)
}
fileprivate func registeruserintoDb(_ uid: String, values: [String: AnyObject]) {
let ref = Database.database().reference()
let usersReference = ref.child("users").child(uid)

usersReference.updateChildValues(values, withCompletionBlock: { (err, ref) in

if err != nil {
print(err!)
return

}



})
}

最佳答案

这正是错误所说的,您已经有一个使用该电子邮件的用户。相反,请使用 auth.signIn method并检查 currently signed in users .

关于swift - UserInfo={NSLocalizedDescription=该电子邮件地址已被其他帐户使用。, error_name=ERROR_EMAIL_ALREADY_IN_USE},我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48036429/

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