Swift 3:AppDelegate不符合协议GIDSignInDelegate

W.v*_*nus 6 swift google-signin swift3

现在我正在尝试实施Google登录.我跟着这样说:https: //developers.google.com/identity/sign-in/ios/sign-in?ver = swift

但我在AppDelegate.swift中遇到错误:

class AppDelegate: UIResponder, UIApplicationDelegate, GIDSignInDelegate 
....
Run Code Online (Sandbox Code Playgroud)

错误:

类型'AppDelegate'不符合协议'GIDSignInDelegate'

帮我.

Nir*_*v D 30

你需要GIDSignInDelegate在你的实现中实现这两种方法AppDelegate.

func sign(_ signIn: GIDSignIn!, didDisconnectWith user: GIDGoogleUser!, withError error: Error!) {

}

func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!) {

}
Run Code Online (Sandbox Code Playgroud)

  • 伟大的工作,使用谷歌的文档代表,但他们没有更新,也许谷歌也应该更新他们的文档.谢了,兄弟 :) (2认同)