2017-10-22 12 views
1

firebaseのログイン機能を実行しようとしていますが、うまくいきましたが、迅速なバージョンを更新しても機能しません。エラーがnilでnilでない場合は両方ともチェックすると、printステートメントは実行されませんが、前後のプリントは実行されません。なぜ誰もこれが実行されないだろうが、また、エラーをスローされていない知っていますか?これは代わりにFIRAuthのAUTHfirebaseログイン機能が実行されていません

FIRAuth.auth()?.signIn(withEmail: email, password: password, completion: { user, error in 
    if error == nil { 

     print("Successful login") 

     if user!.isEmailVerified { 
      let vc = self.storyboard!.instantiateViewController(withIdentifier: "ProfileView") as! ProfileView 
      self.present(vc, animated: true, completion: nil) 

     } else { 
      print("nil is hitting") 
     } 
    } 
}) 
print("done running login") 

答えて

1

使用:以下

はコードです。

Auth.auth().createUser(withEmail: email, password: password) { (user, error) in 
    // ... 
} 

よりFirebasesignInFirebase Documention

+0

これはちょうど私に次のエラー与える: '使用を未解決の識別子のAuth' – Drew

+0

の可能性が高いfirebaseのバージョンを更新していません。 cocopodsを使ってfirebaseを更新してください。 –

0

を読んで知っている、あなたはAuthを使用する必要がある代わりにFIRAuth

Auth.auth().signIn(withEmail: "[email protected]", 
        password: "123456") { (user, error) in 

    if error == nil { 
     print("successful login") 
    } 

} 
0
Auth.auth().signIn(withEmail: email!, password: password!) { (user, error) in 
      if let error = error { print("Enter Valid email and password") 
       }else{ 
       if Auth.auth().currentUser!.isEmailVerified == true{ 
       let vc = self.storyboard!.instantiateViewController(withIdentifier: "ProfileView") as! ProfileView 
       self.present(vc, animated: true, completion: nil)}}} 
+0

私はまだエラーが発生しています:最初の行に「未解決の識別済みのAuth」を使用しています – Drew

+0

あなたはこれを行う必要があります - インポートFirebaseAuth –

+0

まだインポートしていますが、同じエラーが発生しています – Drew

関連する問題