我们如何在ios中检索facebook的third_party_id

时间:2014-05-30 06:20:36

标签: ios facebook-graph-api facebook-fql facebook-ios-sdk

我想使用Facebook SDK在我的ios应用程序中检索Facebook用户的 third_party_id 。目前我正在尝试这个

[FBSession openActiveSessionWithPublishPermissions:@[@"basic_info", @"email", @"user_likes",@"user_mobile_phone",@"publish_actions",@"third_party_id"] defaultAudience:FBSessionDefaultAudienceFriends allowLoginUI:YES completionHandler: ^(FBSession *session, FBSessionState state, NSError *error) {
            // Handler for session state changes
            // This method will be called EACH time the session state changes,
            // also for intermediate states and NOT just when the session open
            [self sessionStateChanged:session state:state error:error];
        }];

如果我在权限中添加third_party_id,我会收到以下错误

**Error Domain=com.facebook.sdk Code=2 "Invalid Scope: third_party_id" UserInfo=0xd26ff50** {
com.facebook.sdk:ErrorSessionKey=<FBSession: 0x11f817f0, state: FBSessionStateClosedLoginFailed, loginHandler: 0x0, appID: 230846087119839, urlSchemeSuffix: , tokenCachingStrategy:<FBSessionTokenCachingStrategy: 0xc689090>, expirationDate: (null), refreshDate: (null), attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:(null)>, com.facebook.sdk:ErrorLoginFailedReason=com.facebook.sdk:UserLoginOtherError, NSLocalizedDescription=Invalid Scope: third_party_id, com.facebook.sdk:ErrorLoginFailedOriginalErrorCode=100
}

我怎样才能克服这一点? 如果我通常检索用户配置文件我没有得到third_party_id 我得到这个参数

{
    email = "xxx@xxx.com";
    "first_name" = xxxx;
    gender = male;
    id = xxxxx;
    "last_name" = Mehta;
    link = "https://www.facebook.com/xxxxxxxx";
    locale = "en_US";
    name = "xxxxxxx";
    timezone = "5.5";
    "updated_time" = "2014-04-01T08:52:10+0000";
    username = "xxxxxxxxx";
    verified = 1;
}

1 个答案:

答案 0 :(得分:0)

对于您的评论:我如何在“我”请求中检索third_party_id

试试这个:

[FBRequestConnection startWithGraphPath:@"me?fields=third_party_id" completionHandler:^(FBRequestConnection *connection, id result, NSError *error)
    {
        if (!error)
        {
            NSLog(@"user events: %@", result);
        }
        else
        {

        }            
    }];

记录:

  

用户事件:{       id = 1234567;       “third_party_id”=“xedted10XKVl1DtF9WHOFa_LoR8”; }