Detect iOS Google+ Sign In was incomplete.

前端 未结 1 2131
攒了一身酷
攒了一身酷 2021-02-19 20:48

By \"incomplete\" I\'m referring to a particular user journey

  • user opens iOS application, and chooses Google+ to sign in.
  • Google SDK navigates user to G+
1条回答
  •  Happy的楠姐
    2021-02-19 21:46

    As per the situation described, that a user has skipped the authentication process of Google Sign in or has navigate to Home Screen by tapping home button.

    1st Way:-

    On that basis, GPPSignInDelegate never gets called

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

    Now, if the developer is saving the Google Plus auth key in NSUserDefault or a in a plist or in local DB , then he directly check it in didBecomeActive method of AppDelegate .

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

    2nd Way:-

    In applicationDidBecomeActive method one can directly check if authentication is completed or not

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

    0 讨论(0)
提交回复
热议问题