检索facebook生日返回(null)

时间:2014-07-21 19:54:32

标签: ios objective-c facebook

我试图通过FBRequestConnection检索当前用户的生日。我已成功检索到ID,姓名和性别,但生日只返回null。为了让当前用户生日,为什么以及我该怎么办?我需要某种许可吗?

        [FBRequestConnection
         startForMeWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
             if (!error) {
                 NSString *facebookId = [result objectForKey:@"id"];
                 NSString *facebookName = [result objectForKey:@"name"];
                 NSString *birthday = result[@"birthday"];
                 NSString *gender = result[@"gender"];

               NSLog(@"%@", birthday);

             }
         }];

1 个答案:

答案 0 :(得分:0)

loginButton = [[FBSDKLoginButton alloc] init];
loginButton.frame = CGRectMake(self.view.frame.size.width/2-loginButton.frame.size.width, self.view.frame.size.height/2+100, 250, 20);
loginButton.readPermissions=@[@"email",@"user_birthday"];

尝试在上面添加代码。