ios - 检测 iOS Google+ 登录不完整。

标签 ios google-plus

“不完整”指的是特定的用户旅程

  • 用户打开 iOS 应用程序,然后选择 Google+ 登录。
  • Google SDK 将用户导航到 G+ 应用程序以进行登录(如果未安装 G+,则导航到网页 View )。
  • 用户离开 Google+(例如点击主页按钮)没有接受或拒绝请求的权限。
  • 用户导航回 iOS 应用程序。

使用 Facebook SDK,当应用程序激活时,如果用户通过调用 [FBAppCall handleDidBecomeActive];

Google+ SDK 似乎没有任何先进之处。

如何检测用户从未完成 Google+ 登录旅程?

使用 iOS7、Google+ SDK pod 'google-plus-ios-sdk', '~> 1.5'

最佳答案

根据描述的情况,用户已跳过 Google 登录的身份验证过程或已通过点击主页按钮导航到主屏幕。

第一种方式:-

在此基础上,GPPSignInDelegate 永远不会被调用

- (void)finishedWithAuth: (GTMOAuth2Authentication *)auth
                   error: (NSError *) error {
    NSLog(@"Received error %@ and auth object %@",error, auth);
}

现在,如果开发人员将 Google Plus 授权 key 保存在 NSUserDefault 或 plist 或本地数据库中,那么他直接在 AppDelegate 的 didBecomeActive 方法中检查它。

-(void)applicationDidBecomeActive:(UIApplication *)application
{
  //Check whether Google Plus auth key is present from the stored location or variable    
}

第二种方式:-

在applicationDidBecomeActive方法中可以直接查看是否认证完成

-(void)applicationDidBecomeActive:(UIApplication *)application
    {
       if ([[GPPSignIn sharedInstance] authentication]) {
             // The user has  signed in properly
           }
        else
         {
               // The user has  not  signed in properly
         }
    }

关于ios - 检测 iOS Google+ 登录不完整。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23683955/

相关文章:

javascript - Google_Auth_Exception',消息为 'Error fetching OAuth2 access token, message: ' invalid_grant'

ios - 在 google+ IOS Swift 中分享

google-app-engine - 使用 Google Cloud Endpoint (Java) 的内置身份验证时,如何获取当前用户的 Google+ 个人资料?

ios - 收费桥过度释放

ios - 在运行时重新排 ListView 中的单元格

ios - View 消失后 iPhone 键盘消失

jquery - 内嵌 facebook 和 google + 按钮的位置?

ios - 将文本字段输入更改为在 UIDatePicker 中选择的日期(当值更改时)

ios - 自定义一个 UITableViewCell 高亮样式

android - google+ 是如何实现这种布局的?