I have already set the clientID ,scope and then on button click in MyViewController ,i am calling method login from LoginCLass which works but after [signIn authenticate]
This happened to me too in my apps running iOS 8. What did it for me was to set the clientId in the AppDelegate as soon as the app launched, and not in the viewDidLoad method of my UIViewController class as indicated in the Google+ Sign-in for iOS example in the following 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 sharedInstance].clientID = @"xxxxxx.......apps.googleusercontent.com";
...
return YES;
}
So, in your UIViewController class the sign-in method should be:
- (void)viewDidLoad {
[super viewDidLoad];
//Google+ for Logging in the user again if the app has been authorized
signIn = [GPPSignIn sharedInstance];
signIn.shouldFetchGooglePlusUser = YES;
signIn.shouldFetchGoogleUserID = YES;
signIn.shouldFetchGoogleUserEmail = YES;
signIn.scopes = @[ kGTLAuthScopePlusLogin ];
signIn.delegate = self;
[signIn trySilentAuthentication];
...
}