我正在使用此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