2017-01-20 7 views
1

Google Sign-Inをアプリに統合することで、Googleアカウントを使用してFirebaseで認証しようとしています。AppDelegateがSwift 3のプロトコル 'GIDSignInDelegate'に準拠していません

  • スウィフト3
  • Xcodeの8
  • Firebase 3.11.1

を私はまだAppDelegate

// Sign-in flow has finished and was succcesful if error is nil: 
func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!){ 
if let error = error { 
    print(error.localizedDescription) 
    return 
} 

guard let authentication = user.authentication else { return } 
let credential = FIRGoogleAuthProvider.credential(withIDToken: authentication.idToken, 
                 accessToken: authentication.accessToken) 



// Finished disconnecting user from the app succesfully if error is nil: 
func sign(_ signIn: GIDSignIn!, didDisconnectWithUser user: GIDGoogleUser!, 
       withError error: Error!) { 
     // Perform any operations when the user disconnects from app here. 
     // ... 
} 

におけるGIDSignInDelegateの2つのメソッドを実装している:使用

私はまだですコンパイルの問題に直面している:

AppDelegate does not conform to protocol 'GIDSignInDelegate'

enter image description here

+0

方法は、サインインが署名していないと呼ばれているドキュメントによります。 https://developers.google.com/identity/sign-in/ios/api/protocol_g_i_d_sign_in_delegate-p#pub-methodsあなたはGIDSignInDelegateのヘッダーファイルと同じですか? – Gruntcakes

+0

@Grunt私はfunc sign()とfunc signIn()を試しました。それは働かなかった。 https://firebase.google.com/docs/auth/ios/google-signin –

+1

問題のナビゲータ(⌘4)に移動し、エラーの横にある三角形の三角をクリックすると、どの方法が欠落しているかがわかります。 – vadian

答えて

0

あなたがAppDelegateクラスの外にそのプロトコルのメソッドを定義したように見えますので、彼らはただグローバル関数ではなく、メソッドです。

AppDelegate(最初のプロトコルメソッドのすぐ上)を閉じる}内に移動する必要があります。

Tip: if you select all of the code in that file and press Ctrl+I Xcode will reindent your code which may make it easier to see what's going wrong.

+0

問題ありません!時にはそれはより簡単です:) –

+0

私は同じエラーが発生しており、中括弧でコードを書いています –

関連する問題