2016-05-19 18 views
3

Firebase 3.2.0を使用して新しいプロジェクト(Swift 2.2; iOS 9; Xcode 7.3.1)を開始しましたが、私の権限の一部として次のエラーが発生しました/サインアッププロセスを無効な電子メール、弱いパスワードの両方入力:Firebase 3.2.0 - ユーザ作成時の内部エラー

NSError

Error Domain=FIRAuthErrorDomain Code=17999 "An internal error has occurred, print and 
inspect the error details for more information." UserInfo={error_name=ERROR_INTERNAL_ERROR, 
NSUnderlyingError=0x7c0549a0 {Error Domain=FIRAuthInternalErrorDomain Code=3 "(null)" 
UserInfo={FIRAuthErrorUserInfoDeserializedResponseKey=<CFBasicHash 0x7c04bd90 [0x1a701f8]> 
{type = immutable dict, count = 3, 
entries => 
0 : <CFString 0x7c0fb0c0 [0x1a701f8]>{contents = "errors"} = 
<CFArray 0x7c0713a0 [0x1a701f8]>{type = immutable, count = 1, values = (
0 : <CFBasicHash 0x7c0fac00 [0x1a701f8]>{type = immutable dict, count = 3, 
entries => 
0 : <CFString 0x7c051080 [0x1a701f8]>{contents = "reason"} = 
<CFString 0x7c0553f0 [0x1a701f8]>{contents = "invalid"} 
1 : <CFString 0x7c055f30 [0x1a701f8]>{contents = "message"} = 
<CFString 0x7c061580 [0x1a701f8]>{contents = "INVALID_EMAIL"} 
2 : <CFString 0x7c054fd0 [0x1a701f8]>{contents = "domain"} = 
<CFString 0x7c060290 [0x1a701f8]>{contents = "global"} 
} 

)} 
1 : <CFString 0x7c05aae0 [0x1a701f8]>{contents = "code"} = 
<CFNumber 0x7c073010 [0x1a701f8]>{value = +400, type = kCFNumberSInt64Type} 
2 : <CFString 0x7c067e70 [0x1a701f8]>{contents = "message"} = 
<CFString 0x7c0543a0 [0x1a701f8]>{contents = "INVALID_EMAIL"} 
} 
}}, NSLocalizedDescription=An internal error has occurred, print and inspect the error 
details for more information.} 

を...と、以下のように私のコードです....

AuthViewController.swift

if let email = emailField.text where email != "", let password = passwordField.text where 
    password != "" {FIRAuth.auth()?.signInWithEmail(email, password: password) { (user, error) in 
    if let error = error { 
      if let errorCode = FIRAuthErrorCode(rawValue: error.code) { 
       switch errorCode { 
       case .ErrorCodeNetworkError: 
        print("A network error occurred") 
       case .ErrorCodeUserNotFound: 
        print("ATTEMPTING TO CREATE USER") 
        FIRAuth.auth()?.createUserWithEmail(email, password: password) { (user, error) in 
         if let error = error { 
          if let errCode = FIRAuthErrorCode(rawValue: error.code) { 
           switch errCode { 
           case .ErrorCodeInvalidEmail: 
            print("invalid email") 
           case .ErrorCodeWeakPassword: 
            self.insertErrorLabel("Password is considered weak (< 6 characters). Try again") 
           default: 
            print("Create User Error: \(error)") 
           } 
          } 
         } else { 
          // create a user in the database... 
         } 
        } 
       case .ErrorCodeUserTokenExpired: 

       .... 

実行は、signInWithEmail()で.ErrorCodeUserNotFoundの大文字と小文字を区別します。次に、createUserWithEmail()のデフォルトのケースをヒットします。

文書からは、createUserWithEmail()関数でINVALID_EMAILエラーキーが使用できるように見えますが、InvalidEmailエラーの場合よりも内部エラーが発生しているようです。

3つの質問:

  1. は私がのcreateUserにつながるサインインに失敗して、ここで許容可能な流れを持っていますか?
  2. 実際のエラーの原因を教えてください。
  3. どうすれば対応できますか?

ありがとうございます。

答えて

4

今後の参考として、上記のエラーのバグを提起し、Firebase/GoogleがSDKの次のリリースで対応することを確認しました。

+0

'pod 'Firebase'、 '〜> 3.3' ' –

1

私は同じ問題があり、Firebaseコンソールでユーザーを追加することさえできないことに気付きました。しかし、奇妙なことに、無効にしたGoogleのログインよりも有効にして、手動でユーザーを追加することができました。だから私はcreateUserWithEmailでユーザーを作成しようとし、それは働いた。

電子メールによるログイン機能を有効または無効にすると、Firebase側で問題を解決する設定がリセットされることがあります。この「回避策」は、問題がSDKではなくサーバー側にあると考えています。

0

この投稿をチェック:https://stackoverflow.com/a/38076718 GoogleコンソールでIDツールキットAPIを有効にすると、問題を解決できます。

+1

でまだエラーが発生していますが、これは答えではなくコメントでなければならないと感じています – MarkoCen

+0

既に有効になっています... –

関連する問題