【发布时间】:2016-09-23 19:29:55
【问题描述】:
我无法弄清楚如何在新版本的 Firebase 中读取 FIRAuthErrorNameKey。以下是我到目前为止的内容,但是“let errorCode = FIRAuthErrorNameKey”行不正确。通过阅读Firebase documentation,我还尝试从 userInfo 访问错误代码,但没有成功,我没有想法。
// 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
}
}
})
【问题讨论】:
标签: ios swift firebase firebase-authentication