Facebook iOS SDK 4不会返回所有数据

时间:2016-05-08 20:03:26

标签: ios facebook-sdk-4.x

我使用此代码登录Facebook:

  [loginManager logInWithReadPermissions:@[@"email", @"public_profile", @"user_birthday", @"user_friends"]
                      fromViewController:self
                                 handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) { ....   }];

这段代码可以获取朋友数据:

FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                              initWithGraphPath:@"me/invitable_friends"
                              parameters:@{@"fields": @"id, first_name, last_name, birthday, gender, picture, devices"}
                              HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) { ....  }];

我没有收到以下信息的原因:

  • 性别
  • 设备
  • 生日

1 个答案:

答案 0 :(得分:0)

(FBSDK 4.11.0)

我的GraphRequest:

NSString *path = [NSString stringWithFormat:@"/me/friends?limit=1000"];

FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                                initWithGraphPath:path
                                parameters:@{@"fields": @"id, name, link, picture.type(small), birthday, gender, devices"}
                                HTTPMethod:@"GET"];

返回数据:

{
    devices =     (
                {
            hardware = iPhone;
            os = iOS;
        }
    );
    gender = female;
    id = 1265683xxxx273xx;
    link = "https://www.facebook.com/app_scoped_user_id/1265683xxxx273xx/";
    name = "Alexandra Szab\U00f3";
    picture =     {
        data =         {
            "is_silhouette" = 0;
            url = "https://scontent.xx.fbcdn.net/v/t1.0-1/p50x50/1007501_1223615617667435_678361396224449932_n.jpg?oh=b3c99d05faf1265683xxxx273xx&oe=57C0940";
        };
    };
}