I'm relatively new to Swift and Firebase. Any help would be greatly appreciated on the following.
I'm having trouble figuring out how to read the FIRAuthErrorNameKey in the new version of Firebase. The following is what I have so far, but the "let errorCode = FIRAuthErrorNameKey" line is incorrect. From reading the Firebase documentation I also tried accessing the error code from the userInfo, but was unsuccessful and am out of ideas.
// Send request to Firebase to add user to register user
FIRAuth.auth()?.createUserWithEmail(emailTextField.text!, password: passwordTextField.text!, completion: { (user, error) in
// Check for errors and respond to user accordingly.
if error != nil {
let errorCode = FIRAuthErrorNameKey
switch errorCode {
case "FIRAuthErrorCodeEmailAlreadyInUse":
// Add logic accordingly
case ...:
// Add logic accordingly
case default:
// Add logic accordingly
}
}
})
Aucun commentaire:
Enregistrer un commentaire