我正在使用 Facebook SDK v.3.18.2
我只想要用户的名字、姓氏、电子邮件和出生日期,我得到了除了出生日期之外的所有内容。
我肯定在许可方面做错了吗?没有把握。
这里有一些代码可以帮助您找出我的问题,
[FBSession openActiveSessionWithReadPermissions:@[@"public_profile"] allowLoginUI:YES completionHandler:
^(FBSession *session, FBSessionState state, NSError *error) {
// Call the sessionStateChanged:state:error method to handle session state changes
[self sessionStateChanged:session state:state error:error];
}];
// This method will handle ALL the session state changes in the app
- (void)sessionStateChanged:(FBSession *)session state:(FBSessionState) state error:(NSError *)error
{
// If the session was opened successfully
if (!error && state == FBSessionStateOpen){
NSLog(@"Session opened");
if (FBSession.activeSession.isOpen) {
// This is not working though I'm putting it as comment
// [[FBRequest requestForMe] startWithCompletionHandler:
// ^(FBRequestConnection *connection,
// NSDictionary<FBGraphUser> *user,
// NSError *error) {
// if (!error) {
// NSLog(@"User Info : %@",user);
// }
// }];
[[FBRequest requestForGraphPath:@"me"] startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
NSLog(@"%@",result);
}];
}
return;
}
这是输出日志:
{
email = "email@domain";
"first_name" = Hemang;
gender = male;
id = someId;
"last_name" = Shah;
link = "https://www.facebook.com/app_scoped_user_id/someId/";
locale = "en_US";
name = "Hemang Shah";
timezone = "5.5";
"updated_time" = "some date and time";
verified = 1;
}
但是出生日期不见了,我也在我的个人资料中设置了它。
更新:
尝试使用以下权限无效!
“用户生日”或“生日”