我正在使用此tutorial实施通过谷歌应用程序登录。Google登录后不允许重定向到应用程序
- 我通过cocoapods安装了GoogleSignIn。
pod 'GoogleSignIn', '~> 2.4.0'
- 添加了
GSignIn-Bridging-Header.h
与#import <GoogleSignIn/GoogleSignIn.h>
里面。 与
GIDSignInButton
类创建一个视图添加代码:
class ViewController: UIViewController, GIDSignInDelegate, GIDSignInUIDelegate { override func viewDidLoad() { super.viewDidLoad() GIDSignIn.sharedInstance().delegate = self GIDSignIn.sharedInstance().uiDelegate = self GIDSignIn.sharedInstance().clientID = "KEY" } func signIn(signIn: GIDSignIn!, didSignInForUser user: GIDGoogleUser!, withError error: NSError!) { if let err = error { print(error) } else { print(GIDSignIn.sharedInstance().currentUser.profile.name) print(GIDSignIn.sharedInstance().currentUser.profile.email) self.performSegueWithIdentifier("idSegueContent", sender: self) } } func signIn(signIn: GIDSignIn!, didDisconnectWithUser user: GIDGoogleUser!, withError error: NSError!) { } }
但是当我点击允许
它将我重定向到google.com,而不是应用程序。
https://developers.google.com/identity/sign-in/ios/start ?ver = swift 使用此 –
嗨,你有任何错误? – Birendra
在控制台中没有错误 – Arti