当我在模拟器中使用此代码时 - 它完美运行:
// Present a view that prompts the user to sign in with Google
func signIn(signIn: GIDSignIn!,
presentViewController viewController: UIViewController!) {
self.presentViewController(viewController, animated: true, completion: nil)
}
// Dismiss the "Sign in with Google" view
func signIn(signIn: GIDSignIn!,
dismissViewController viewController: UIViewController!) {
self.dismissViewControllerAnimated(true, completion: nil)
}
func signIn(signIn: GIDSignIn!, didSignInForUser user: GIDGoogleUser!,
withError error: NSError!) {
if (error == nil) {
// Perform any operations on signed in user here.
let accessToken = user.serverAuthCode // Safe to send to the server
print("AAA \(accessToken)")
} else {
print("\(error.localizedDescription)")
}
}
但它在真实设备中不起作用。当我点击"允许"按钮,它会刷新页面并将我转发到google.com网站。
什么问题?