简体   繁体   English

使用iOS SDK提取Facebook朋友对某些朋友返回null

[英]Fetching Facebook friends with iOS SDK returns null on some friends

I am using this code to fetch friends birthday: 我正在使用以下代码来获取朋友的生日:

- (void)apiGraphFriendsWithBirthdays {
[self showActivityIndicator];

HackbookAppDelegate *delegate = (HackbookAppDelegate *)[[UIApplication sharedApplication] delegate];
NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
 @"picture,id,name,link,birthday,gender,last_name,first_name",@"fields",
 nil];

[[delegate facebook] requestWithGraphPath:@"me/friends" andParams:params andHttpMethod:@"GET" andDelegate:self];

} }

Then I'm printing to log some of what I fetched: 然后,我打印以记录我所获取的一些信息:

        NSMutableArray *friends = [[NSMutableArray alloc] initWithCapacity:1];
        NSArray *resultData = [result objectForKey:@"data"];
        if ([resultData count] > 0) {
            for (NSUInteger i=0; i<[resultData count] && i < 25; i++) {
                [friends addObject:[resultData objectAtIndex:i]];

                NSDictionary *friend = [resultData objectAtIndex:i];
                long long fbid = [[friend objectForKey:@"id"]longLongValue];
                NSString *name = [friend objectForKey:@"name"];
                NSString *birthday = [[friend objectForKey:@"birthday"] description];
                NSLog(@"id: %lld - Name: %@ - Birthday: %@", fbid, name,birthday);


            }

        } else {
            [self showMessage:@"You have no friends."];
        }
        [friends release];

for some reason some of my friends birthdays are null although I can see their birthdays on Facebook. 由于某些原因,尽管我可以在Facebook上看到他们的生日,但我的一些朋友的生日却没有。

Is that something on my code or is it some kind of specific user privacy settings? 这是我的代码上的东西,还是某种特定的用户隐私设置?

You need to request permissions to view 'friends_birthday' 您需要请求权限才能查看“ friends_birthday”

Facebook Permissions Facebook的权限

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM