我正在为 iOS 进行 Google+ 登录。
我正在调用身份验证方法
[signIn authenticate];
我没有使用登录按钮。
在这种情况下,身份验证后不会调用以下方法
- (void)finishedWithAuth: (GTMOAuth2Authentication *)auth
error: (NSError *) error
请问有什么方法可以处理回调吗?
最佳答案
你有没有一步一步走什么Google+ Sign-In for iOS
说?如果是,那么你一定错过了关键的一步。
第 5 步
在你的AppDelegate.m
文件中
#import <GooglePlus/GooglePlus.h>
第六步
从您的应用委托(delegate)的 URL 处理程序调用 GPPURLHandler
URL 处理程序。此处理程序将正确处理您的应用程序在身份验证过程结束时收到的 URL。
- (BOOL)application: (UIApplication *)application openURL: (NSURL *)url sourceApplication: (NSString *)sourceApplication annotation: (id)annotation
{
return [GPPURLHandler handleURL:url sourceApplication:sourceApplication annotation:annotation];
}
此方法将在您的应用程序在 Google+ OAuth 之后返回时调用,并且会立即调用
- (void)finishedWithAuth: (GTMOAuth2Authentication *)auth error: (NSError *) error
viewController
中的方法
立即尝试。
关于ios - 身份验证完成后未调用 finishedWithAuth 方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16731792/