我正在尝试检索 facebook 朋友的生日数据,但它返回 null。我正在使用这段代码:
FBRequest* friendsRequest = [FBRequest requestForMyFriends];
[friendsRequest startWithCompletionHandler: ^(FBRequestConnection *connection,
NSDictionary* result,
NSError *error) {
NSArray* friends = [result objectForKey:@"data"];
NSLog(@"Found: %i friends", friends.count);
for (NSDictionary<FBGraphUser>* friend in friends) {
NSLog(@"I have a friend named %@ - birthday %@", friend.name, friend.birthday);
}
}];
朋友姓名没问题,但朋友生日或不是基本朋友数据之一的所有数据都返回 null。请注意,我已经在 facebook.com 应用页面和 openSession 方法(登录)中添加了 user_birthday 和 friends_birthday 权限:
- (void)openSession
{
NSArray *permissions = [[NSArray alloc] initWithObjects:
@"user_birthday",
@"friends_birthday",
nil];
[FBSession openActiveSessionWithReadPermissions:permissions
allowLoginUI:YES
completionHandler:
^(FBSession *session,
FBSessionState state, NSError *error) {
[self sessionStateChanged:session state:state error:error];
}];
}
在这里需要一些帮助,我已经尝试了一切。