Los methods de delegado GPPSignIn no se ejecutan?

He integrado Goolge + signin a iOS (usando ObjC) siguiendo las instrucciones en el website de google, pero los methods delegates (estoy interesado en este método finishedWithAuth:auth:error ) de GPPSignIn no se están ejecutando. Tengo que almacenar el token de acceso recibido en el método de delegado en las preferences compartidas.

Aquí está mi código:

 -(void)finishedWithAuth:(GTMOAuth2Authentication *)auth error:(NSError *)error { NSLog(@"Received error %@ and auth object %@",error, auth); if (error) { NSLog(@"error"); } else { NSLog(@"success"); } } - (BOOL)application: (UIApplication *)application openURL: (NSURL *)url sourceApplication: (NSString *)sourceApplication annotation: (id)annotation { NSLog(@"application"); return [GPPURLHandler handleURL:url sourceApplication:sourceApplication annotation:annotation]; } -(void)refreshInterfaceBasedOnSignIn { NSLog(@"refreshInterfaceBasedOnSignIn"); if ([[GPPSignIn shanetworkingInstance] authentication]) { // The user is signed in. self.signInButton.hidden = YES; [self readProfileInformation]; // Perform other actions here, such as showing a sign-out button [self readProfileInformation]; NSLog(@"readProfileInformation"); } else { self.signInButton.hidden = NO; // Perform other actions here } } - (void)disconnect { [[GPPSignIn shanetworkingInstance] disconnect]; } - (void)didDisconnectWithError:(NSError *)error { if (error) { NSLog(@"Received error %@", error); } else { // The user is signed out and disconnected. // Clean up user data as specified by the Google+ terms. } } - (void)signOut { [[GPPSignIn shanetworkingInstance] signOut]; } -(void)viewDidLoad { [super viewDidLoad]; // google+ code GPPSignIn *signIn = [GPPSignIn shanetworkingInstance]; signIn.shouldFetchGooglePlusUser = YES; // uncommented to fetch user email signIn.shouldFetchGoogleUserEmail = YES; // You previously set kClientId in the "Initialize the Google+ client" step signIn.clientID = kClientId; // Uncomment one of these two statements for the scope you chose in the previous step // signIn.scopes = @[ kGTLAuthScopePlusLogin ]; // uncommented & set to "profile" & "email" scope: signIn.scopes = @[ @"profile", @"email" ]; // Optional: declare signIn.actions, see "app activities" signIn.delegate = self; // try silent authentication [signIn trySilentAuthentication]; } @end 

Gracias

Esto también me sucedió en mis aplicaciones con iOS 8. Lo que hizo fue configurar el ID del cliente en AppDelegate tan pronto como se lanzó la aplicación y no en el método viewDidLoad de mi class UIViewController como se indica en el inicio de session de Google+ para ejemplo de iOS en la siguiente URL: https://developers.google.com/+/mobile/ios/sign-in

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { / //Google+ // Set app's client ID for |GPPSignIn| and |GPPShare|. [GPPSignIn shanetworkingInstance].clientID = @"xxxxxx.......apps.googleusercontent.com"; ... return YES; } 

Por lo tanto, en su class UIViewController, el método de inicio de session debería ser:

  - (void)viewDidLoad { [super viewDidLoad]; //Google+ for Logging in the user again if the app has been authorized signIn = [GPPSignIn shanetworkingInstance]; signIn.shouldFetchGooglePlusUser = YES; signIn.shouldFetchGoogleUserID = YES; signIn.shouldFetchGoogleUserEmail = YES; signIn.scopes = @[ kGTLAuthScopePlusLogin ]; signIn.delegate = self; [signIn trySilentAuthentication]; ... }