Google+ iOS登录错误“com.google.GTMHTTPFetcher”
问题描述:
过去3天,我陷入了一个非常令人恼怒的问题。我已经实施了Google+登录功能,直到我从G + iOS SDK版本1.5.1升级到1.7.1后,它才运行良好。我确实喜欢它在Google Developers中提到。当我按下登录按钮后,它会转到设备上的Safari或Google+应用程序,并切换回我的应用程序,并出现一个我无法解决的错误。Google+ iOS登录错误“com.google.GTMHTTPFetcher”
这是多么我已经实现,
StartScreenViewController.h
#import <GooglePlus/GooglePlus.h>
@interface StartScreenViewController : UIViewController <GPPSignInDelegate> {
GPPSignIn *signIn;
}
StartScreenViewController.m
#import <GoogleOpenSource/GoogleOpenSource.h>
static NSString * const kClientId = @"********-*************.apps.googleusercontent.com";
- (void)initUI {
btnGooglePlus = [UIButton buttonWithType:UIButtonTypeCustom];
[btnGooglePlus addTarget:self action:@selector(loginWithGooglePlus:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btnGooglePlus];
}
- (void)viewDidLoad {
signIn = [GPPSignIn sharedInstance];
signIn.shouldFetchGooglePlusUser = YES;
signIn.shouldFetchGoogleUserEmail = YES;
signIn.clientID = kClientId;
signIn.scopes = @[ kGTLAuthScopePlusLogin ];
signIn.delegate = self;
}
-(void)loginWithGooglePlus:(id)sender {
[signIn authenticate];
}
它切换回应用程序,并调用委托方法- (无效)finishedWithAuth:(GTMOAu th2Authentication *)AUTH错误:(NSError *)错误
什么,我得到的是一条错误消息:错误域= com.google.GTMHTTPFetcher代码= -1“的操作无法完成。 (com.google.GTMHTTPFetcher错误-1)”
我甚至实现GPPSignInButton,它也给出了相同的结果。我不知道为什么会发生。如果任何人都可以点我到正确的方向,这将是一个很大的帮助。
感谢。
答
我前几天与G + SDK工作,一切都很好。我的实现,从你的不同之处在于我没有设置任何范围,只有trySilentAuthentication
等之后使用验证这个:
-(void)loginWithGooglePlus:(id)sender {
if (![signIn trySilentAuthentication]) {
[signIn authenticate];
}
}
您还应该尝试通过disconnect
删除旧的钥匙串数据
感谢您的提示。我尝试了所有这些。没有运气。 – 2014-10-26 21:05:35