检测到iOS Google+登录不完整.

ajm*_*all 12 ios google-plus

"不完整"我指的是特定的用户旅程

  • 用户打开iOS应用程序,并选择Google+登录.
  • Google SDK会将用户导航到G +应用程序以进行登录(如果未安装G +,则导航到webview).
  • 用户导航离开Goog​​le+(例如点击主页按钮),而不接受或拒绝所请求的权限.
  • 用户导航回iOS应用程序.

使用Facebook SDK,当应用程序变为活动状态时,如果用户通过呼叫跟随类似的旅程,则会关闭登录会话 [FBAppCall handleDidBecomeActive];

似乎没有像Google+ SDK那样先进的内容.

如何检测到用户从未完成过Google+登录?

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

Viz*_*llx 5

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

第一种方式: -

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

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

现在,如果开发人员在NSUserDefault或plist或本地数据库中保存Google Plus身份验证密钥,那么他会直接在AppDelegate的didBecomeActive方法中检查它.

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

第二种方式: -

在applicationDidBecomeActive方法中,可以直接检查验证是否完成

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