这是Firebase guide和Google guide:
所以
>将Google添加到podfile – CHECK
>在BrIDging-header中添加了行 – CHECK
>添加了GoogleService-Info.pList&捆绑标识符&将客户端ID反转为URL方案 – 检查
> App Delegate有以下内容,没有错误,但我注意到Facebook登录(正常工作)和新Google之间可能存在冲突,我不知道如何一起处理:
附:我没有在这里向AppDelegate添加GIDSignInDelegate,因为我正计划让我的VC处理登录逻辑,如下所示……
> LoginVC VIEwController代码:
class LoginVC: UIVIEwController,UIVIEwControllerTransitioningDelegate,UITextVIEwDelegate,UITextFIEldDelegate,GIDSignInDelegate,GIDSignInUIDelegate { overrIDe func vIEwDIDLoad() { super.vIEwDIDLoad() let ref = Firebase(url: "https://MYAPPID.firebaseio.com") GIDDSignIn.sharedInstance().delegate = self GIDSignIn.sharedInstance().uIDelegate = self GIDSignIn.sharedInstance().signInSilently() // for if the user has recently been authenticated }
然后,从我所看到的……应该是Google需要与Firebase交流的所有内容:
// Implementing the required GIDSignInDelegate methods func GoogleSignIn(signIn: GIDSignIn!,dIDSignInForUser user: GIDGoogleUser!,withError error: NSError!) { if (error == nil) { // Auth with Firebase let userID = user.userID let IDToken = user.authentication.IDToken let fullname = user.profile.name let givenname = user.profile.givenname let familyname = user.profile.familyname let email = user.profile.email ref.authWithOAuthProvIDer("Google",token: user.authentication.accesstoken,withCompletionBlock: { (error,authData) in // User is logged in! }) } else { print("\(error.localizedDescription)") } } func GoogleSignOut() { GIDSignIn.sharedInstance().signOut() ref.unauth() } // Implement the required GIDSignInDelegate methods and Unauth when disconnected from Google func signIn(signIn: GIDSignIn!,dIDdisconnectWithUser user:GIDGoogleUser!,withError error: NSError!) { ref.unauth() } // IBAction to handle the sign-in process @IBAction func Googlebuttonpressed(sender: TKTransitionsubmitbutton!) { GIDSignIn.sharedInstance().signIn() }
百思不得其解?很抱歉这些人很久……但我已经完成了Firebase指南建议的所有内容,这意味着AppDelegate的Google文档中的逻辑就在ProfileVC中.有什么指针吗?
解决方法 它说你的班级没有为你的GIDSignInDelegate实现所需的方法. Swift 3中的方法名称有重大变化.所以你的新方法将是public func sign(_ signIn: GIDSignIn!,dIDSignInFor user:
GIDGoogleUser!,withError error: NSError!)
请检查库屏幕截图.所以在新的swift 3命名方法或类的约定中缺少.
以上是内存溢出为你收集整理的swift – 通过Firebase登录Google:GIDSignInDelegate不符合ViewController全部内容,希望文章能够帮你解决swift – 通过Firebase登录Google:GIDSignInDelegate不符合ViewController所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)