Detect iOS Google+ Sign In was incomplete.
google-plus, ios
Solution
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
}
}
Problem
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+ application for sign in (or webview if G+ not installed). - user navigates away from Google+ (tapping home button for instance) without accepting or denying permissions requested. - user navigates back to iOS application. Using Facebook SDK, when application becomes active, the sign in session is closed if the user follows similar journey via the call to ` [FBAppCall handleDidBecomeActive]; ` It appears that there is nothing as advanced from Google+ SDK. How can I detect that the user never completed the Google+ sign in journey? Using iOS7, Google+ SDK ` pod 'google-plus-ios-sdk', '~> 1.5' `