簡體   English   中英

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

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

我正在使用以下代碼來獲取朋友的生日:

- (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];

}

然后,我打印以記錄我所獲取的一些信息:

        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];

由於某些原因,盡管我可以在Facebook上看到他們的生日,但我的一些朋友的生日卻沒有。

這是我的代碼上的東西,還是某種特定的用戶隱私設置?

您需要請求權限才能查看“ friends_birthday”

Facebook的權限

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM