我正在尝试使用 Facebook SDK 在 iOS 上为 FB 朋友获取工作信息。这是我正在使用的代码:
if (FBSession.activeSession.isOpen) {
NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"work", @"fields",
nil];
FBRequest *request = [FBRequest requestWithGraphPath:@"me/friends" parameters:params HTTPMethod:@"GET"];
[request startWithCompletionHandler:
^(FBRequestConnection *connection, NSDictionary *result, NSError *error) {
if (!error) {
if (result) {
if (result.count) {
NSMutableArray *friendsWithJobTitles = [NSMutableArray array];
for (id aFriend in [result objectForKey:@"data"]) {
if ([aFriend objectForKey:@"work"]) {
[friendsWithJobTitles addObject:aFriend];
}
}
NSLog(@"result = %@", friendsWithJobTitles);
}
}
}
}];
}
由于某种原因,friendsWithJobTitles 总是空白。请帮忙。