1
私たちはFirebaseを大幅に更新しており、私は認証システムに苦労しています。別のエラーが発生したときにアラートを表示したい。今の新しいFirebaseユーザーを作成する - 正しい方法
私は
FIRAuth.auth()?.createUserWithEmail(email, password: pwd) { (user, error) in
if let error = error {
print(error.localizedDescription)
if error.code == statusTooShortPassword {
Alert(title: "Error", message: "The password must be 6 characters long or more")
.showOkay()
} else if error.code == statusEmailInvalid {
Alert(title: "Error", message: "Invalid email. Try again")
.showOkay()
} else {
print(error)
Alert(title: "Error", message: "Try again")
.showOkay()
}
}
}
を持っているしかし、私は強く感じerror.code
は、新しいユーザーの作成を処理するための最良の方法ではありません持っています。私は、ドキュメントのこの部分で探しています:
しかし、私は誰かが、これを行うための正しい方法をしてください提供してくださいすることができFIRAuth.auth()?.createUserWithEmail
内FIRAuthErrorCodeInvalidEmail
を実装する方法がわかりませんか?
UPDATE: メールが無効な形式であるとき、私はこれを取得:
私の更新されたコードError Domain=FIRAuthErrorDomain Code=17999 "An internal error has occurred, print and inspect the error details for more information." UserInfo={NSUnderlyingError=0x7fc3537ceca0 {Error Domain=FIRAuthInternalErrorDomain Code=3 "(null)" UserInfo={FIRAuthErrorUserInfoDeserializedResponseKey=<CFBasicHash 0x7fc3537d28c0 [0x1091b5a40]>{type = immutable dict, count = 3,
entries =>
0 : <CFString 0x7fc3537c8c80 [0x1091b5a40]>{contents = "message"} = <CFString 0x7fc3537d2740 [0x1091b5a40]>{contents = "INVALID_EMAIL"}
1 : errors = <CFArray 0x7fc3537ba570 [0x1091b5a40]>{type = immutable, count = 1, values = (
0 : <CFBasicHash 0x7fc3537a9190 [0x1091b5a40]>{type = immutable dict, count = 3,
entries =>
0 : reason = invalid
1 : message = <CFString 0x7fc3537e7030 [0x1091b5a40]>{contents = "INVALID_EMAIL"}
2 : domain = global
}
)}
2 : code = <CFNumber 0xb000000000001903 [0x1091b5a40]>{value = +400, type = kCFNumberSInt64Type}
}
}}, error_name=ERROR_INTERNAL_ERROR, NSLocalizedDescription=An internal error has occurred, print and inspect the error details for more information.}
:
if error.code == FIRAuthErrorCode.ErrorCodeInvalidEmail.rawValue {
Alert(title: "Error", message: "That is some funky email there. Try again")
.showOkay()
} else if error.code == FIRAuthErrorCode.ErrorCodeWeakPassword.rawValue {
Alert(title: "Error", message: "Password is too weak. Try 6 or more characters. Try again")
.showOkay()
} else {
print(error)
}
それは、ありがとうございます。無効な電子メールのエラーが発生した場合にのみ、もう1つ問題があります。 「内部エラーが発生したため、詳細を印刷してエラーの詳細を調べます」私はそのためのコードを実装しましたが、それはトリガしていません。 – Kira
あなたはそのエラーの唯一の人ではないようですhttps://iosprogramming.xyz/firebase-3-2-0-internal-error-on-create-user/ –
これはうんざりです。今、Firebaseがこの問題に対処するのを待っていますか? – Kira