TrySilentAuthentication without the Google+ button

I embed Google+ on iOS, I used this code and it works great

signIn = [GPPSignIn sharedInstance];
signIn.delegate = self;
//signIn.shouldFetchGoogleUserEmail = YES;
signIn.shouldFetchGooglePlusUser = YES;
signIn.clientID = kClientId;
signIn.scopes = [NSArray arrayWithObjects:kGTLAuthScopePlusLogin,nil];
signIn.actions = [NSArray arrayWithObjects:@"http://schemas.google.com/ListenActivity",nil];
[signIn authenticate];

I want to use the [signIn trySilentAuthentication] method so that it does not leave every time a user logs in, but it does not work without using the google + GPPSignInButton button

So what's wrong with using this code, not above

  signIn = [GPPSignIn sharedInstance];
signIn.delegate = self;
//signIn.shouldFetchGoogleUserEmail = YES;
signIn.shouldFetchGooglePlusUser = YES;
signIn.clientID = kClientId;
signIn.scopes = [NSArray arrayWithObjects:kGTLAuthScopePlusLogin,nil];
signIn.actions = [NSArray arrayWithObjects:@"http://schemas.google.com/ListenActivity",nil];
[signIn trySilentAuthentication];

Is it possible to use trySilentAuthentication with didSelectRowAtIndexPath? thanks in advance

+2
source share
1 answer

Yes of course. Make sure that you call [[GPPSignIn sharedInstance] trySilentAuthentication] and not create a new instance of GPPSignIn, and make sure that you only call it after you configure the GPPSignIn instance.

, : - (viewWillAppear ) sharedInstance trySilentAuthentication. didSelectRowAtIndexPath, [[GPPSignIn] sharedInstance] authenticate].

: , trySilentAuthentication.

, Google+, Chrome Safari . , , API. trySilentAuthentication , . , , , , , . ( ), false , finalWithAuth: . (, ).

trySilentAuthentication , . , .

, , . , . , trySilentAuthentication , finalWithAuth: error auth. , Google+ , .

+5

All Articles