Google+ does not return user's friend's email address

落花浮王杯 提交于 2019-12-11 12:33:04

问题


I am trying to access friendslist of user's google+ account.

I have used this code for this purpose...

-(void)getGooglePlusAccounts:(NSString *)notificationNameStr
{
    GTLServicePlus* plusService = [[GTLServicePlus alloc] init];
    plusService.retryEnabled = YES;

    [plusService setAuthorizer:[[GPPSignIn sharedInstance] authentication]];

    GTLQueryPlus *query =
    [GTLQueryPlus queryForPeopleListWithUserId:@"me"
                                    collection:kGTLPlusCollectionVisible];
    [plusService executeQuery:query
            completionHandler:^(GTLServiceTicket *ticket,
                                GTLPlusPeopleFeed *peopleFeed,
                                NSError *error) {
                if (error) {
                    NSLog(@"Error: %@", error);
                } else {
                    // Get an array of people from GTLPlusPeopleFeed
                    NSArray* peopleList = peopleFeed.items;
                    NSLog(@"peopleList: %@", peopleList);

            }];
}

This will gives me UserID, Image, Name but not email.

How can i find the email for the Friend.


回答1:


You can't get the email address for a friend if that person has not set there email address public. So the reason you are not getting an email address returned for your friend is because they have not set the email address public.

To fix this tell your friend to set his email address public. :)

Following quote from the documentation Google+ api - People

emails[] list A list of email addresses that this person has, including their Google account email address, and the public verified email addresses on their Google+ profile. The plus.profile.emails.read scope is needed to retrieve these email addresses, or the email scope can be used to retrieve just the Google account email address.



来源:https://stackoverflow.com/questions/24262227/google-does-not-return-users-friends-email-address

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!