I already set the client identifier, the scope, and then clicked on the mouse in MyViewController, I call the login method from LoginCLass, which works, but after [signIn authenticate], the delegate implementation is completedWithAuth does not receive the call. I installed the .h file as
- (NSError *) login
{
NSLog(@"In login :%@ %@ %@",kClientId,scopes,actions);
if(!kClientId|| !scopes)
{
NSLog(@"Either client ID Or scope is not specified!! ");
NSError *err=[[NSError alloc]initWithDomain:@"Scope not specified" code:0 userInfo:nil];
return err;
}
else
{
NSLog(@"Client ID and Scope are set.");
GPPSignIn *signIn = [GPPSignIn sharedInstance];
signIn.delegate = self;
signIn.shouldFetchGooglePlusUser = YES;
[signIn authenticate];
[signIn trySilentAuthentication];
return nil;
}
}
- (void)finishedWithAuth:(GTMOAuth2Authentication *)auth error:(NSError *)error
{
NSLog(@"Received error %@ and auth object %@",error, auth);
}
as well as in appdelegate i am adding code
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [GPPURLHandler handleURL:url
sourceApplication:sourceApplication
annotation:annotation];
}
I checked the package identifier and the types of URLs to be specified, they are set in the same way as the package identifier from accessing the Google APIs.
These methods are in the LoginClass, which are used in the MyViewController class.
When I set the finishedWithAuth delegate to MyViewController, setting it as GPPSignInDelegate, the code works fine. But I want to use it from LoginClass.
Any idea where I'm wrong?