This is the easiest and the simplest way of fetching the current logged in user's email id
first create an instance variable of GPPSignIn class
GPPSignIn *signIn;
then initialize it in the viewDidLoad
- (void)viewDidLoad
{
[super viewDidLoad];
static NSString * const kClientID = @"your client id";
signIn = [GPPSignIn sharedInstance];
signIn.clientID= kClientID;
signIn.scopes= [NSArray arrayWithObjects:kGTLAuthScopePlusLogin, nil];
signIn.shouldFetchGoogleUserID=YES;
signIn.shouldFetchGoogleUserEmail=YES;
signIn.delegate=self;
}
next implement the GPPSignInDelegate
in your view controller
here you can get the logged in user's email id
- (void)finishedWithAuth:(GTMOAuth2Authentication *)auth
error:(NSError *)error
{
NSLog(@"Received Access Token:%@",auth);
NSLog(@"user google user id %@",signIn.userEmail); //logged in user's email id
}