首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >尝试表单应用时登录Google+失败

尝试表单应用时登录Google+失败
EN

Stack Overflow用户
提问于 2013-09-13 19:51:54
回答 1查看 1.1K关注 0票数 1

在我的iOS应用程序中,我的Google+登录可以正常工作。但当原生Google+应用程序安装在设备上时,它会失败。

如果设备中未安装Google+应用程序,则登录将通过web进行,并且工作正常。如果已安装,则通过此已安装的本机应用程序进行登录。

我正在使用GPPSignIn API进行身份验证。我提到的要实现的谷歌文档是https://developers.google.com/+/mobile/ios/sign-in

我收到的错误是-“登录错误Domain=com.google.GooglePlusPlatform代码=-1”操作无法完成。(com.google.HTTPStatus错误400。)“”

代码语言:javascript
复制
 -(IBAction)handleTapOnGooglePlus:(id)sender {
 if ([[GPPSignIn sharedInstance] authentication]) { 
       [self showProgressHUDWithText:@"Signing Out"];
       [self signOut];
     } else {
       [[GPPSignIn sharedInstance] authenticate];
       [GPPSignIn sharedInstance].attemptSSO = YES;
     }
 }

提前感谢

沙沙克

EN

回答 1

Stack Overflow用户

发布于 2013-11-29 16:38:10

确保您的接口文件中包含了GPPSignInDelegate。那就试试这个吧。

代码语言:javascript
复制
-(IBAction)handleTapOnGooglePlus:(id)sender
 {
  if ([GPPSignIn sharedInstance].authentication)
            { 
                NSLog(@"Already authenticated");
            }
            else
            {
                [[GPPSignIn sharedInstance]signOut];
                 [GPPSignIn sharedInstance].delegate=self;
                [[GPPSignIn sharedInstance]authenticate];

            }

 }

在此处处理回调

代码语言:javascript
复制
-(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");

         }];


}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18785644

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档