2017-01-20 2 views
1

Google 로그인을 앱에 통합하여 Google 계정을 사용하여 Firebase를 인증하려고합니다.AppDelegate가 Swift 3의 'GIDSignInDelegate'프로토콜을 따르지 않습니다.

사용 : 아직

// 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. 
     // ... 
} 

AppDelegate에

GIDSignInDelegate의 두 가지 방법을 구현 3.11.1

8

  • 중포 기지

    • 스위프트 3
    • 엑스 코드 나는 아직 당신이 프로토콜 외부AppDelegate 클래스의 메소드를 정의처럼

      AppDelegate does not conform to protocol 'GIDSignInDelegate'

      enter image description here

  • +0

    설명서에 따르면 이러한 방법을 signIn not sign이라고합니다. 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 (첫 번째 프로토콜 방법 바로 위)을 닫는 } 내부로 이동해야합니다.

    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

    나는 동일한 오류가 발생하고 중괄호로 코드를 작성했습니다. –

    관련 문제