在我的iOS应用程序中,我的Google+登录可以正常工作。但当原生Google+应用程序安装在设备上时,它会失败。
如果设备中未安装Google+应用程序,则登录将通过web进行,并且工作正常。如果已安装,则通过此已安装的本机应用程序进行登录。
我正在使用GPPSignIn API进行身份验证。我提到的要实现的谷歌文档是https://developers.google.com/+/mobile/ios/sign-in
我收到的错误是-“登录错误Domain=com.google.GooglePlusPlatform代码=-1”操作无法完成。(com.google.HTTPStatus错误400。)“”
-(IBAction)handleTapOnGooglePlus:(id)sender {
if ([[GPPSignIn sharedInstance] authentication]) {
[self showProgressHUDWithText:@"Signing Out"];
[self signOut];
} else {
[[GPPSignIn sharedInstance] authenticate];
[GPPSignIn sharedInstance].attemptSSO = YES;
}
}提前感谢
沙沙克
发布于 2013-11-29 16:38:10
确保您的接口文件中包含了GPPSignInDelegate。那就试试这个吧。
-(IBAction)handleTapOnGooglePlus:(id)sender
{
if ([GPPSignIn sharedInstance].authentication)
{
NSLog(@"Already authenticated");
}
else
{
[[GPPSignIn sharedInstance]signOut];
[GPPSignIn sharedInstance].delegate=self;
[[GPPSignIn sharedInstance]authenticate];
}
}在此处处理回调
-(void)finishedWithAuth:(GTMOAuth2Authentication *)auth error:(NSError *)error
{
[[[GPPSignIn sharedInstance] plusService] executeQuery:[GTLQueryPlus queryForPeopleGetWithUserId:@"me"] completionHandler:^(GTLServiceTicket *ticket, GTLPlusPerson *person, NSError *error)
{
if(error)
{
NSLog(@"Google Plus Error:%@",error.localizedDescription]);
}
else
{
NSLog(@"Authenticated");
}];
}https://stackoverflow.com/questions/18785644
复制相似问题