OGeek|极客世界-中国程序员成长平台

标题: ios - 使用我的 FacebookAppID 在 iOS 中不起作用 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 23:50
标题: ios - 使用我的 FacebookAppID 在 iOS 中不起作用

我想使用 Facebook Api 来获取 Facebook 好友列表。因此,我在 Facebook 上创建了新应用程序当我在我的原生 iOS 应用程序中使用该 AppID 和 Bundle ID 并使用 api 获取所有 friend 列表时获得 AppID 并提供 Bundle ID 并获得空 friend 列表。

如果我使用 "SendRequestHowTo" 的 App ID示例项目它获取登录用户的所有好友列表。告诉我如何在 Facebook 开发者网站上配置我的新应用程序以获取好友列表。

我的获取好友列表的代码:

// Query to fetch the active user's friends, limit to 25.
    NSString *query =
    @"SELECT uid, name, pic_square FROM user WHERE uid IN "
    @"(SELECT uid2 FROM friend WHERE uid1 = me())";
    // Set up the query parameter
    NSDictionary *queryParam = @{ @"q": query };
    // Make the API request that uses FQL
    [FBRequestConnection startWithGraphPath"/fql"
                                 parameters:queryParam
                                 HTTPMethod"GET"
                          completionHandler:^(FBRequestConnection *connection,
                                              id result,
                                              NSError *error) {
                              if (error) {
                                  NSLog(@"Error: %@", [error localizedDescription]);
                              } else {
                                  _friends_list = (NSArray *) result[@"data"];
                                  NSLog(@"Result: %@", result);

                                  [self getLetsWalkeeFriendList];

                                  // Sort Table Data
                                  [self sortTableView];
//                                  [_tbl_view_friends reloadData];
                              }
                              [self.view setUserInteractionEnabled:YES];
//                              [self.view hideToastActivity];
                          }]; 

使用示例项目 AppID(即 FacebookAppID:403223126407920 和捆绑标识符:com.facebook.samples.SendRequestsHowTo)。当我用 facebook 登录时,我得到了输出

Result: {
    data =     (
                {
            name = "Assad Sarwar";
            "pic_square" = "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xpa1/t1.0-1/c153.5.545.545/s50x50/1978738_766566543368250_230425531_n.jpg";
            uid = 100000447351759;
        },
                {
            name = "Muhammad Hassan Butt";
            "pic_square" = "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xap1/t1.0-1/c0.0.50.50/p50x50/10167970_873047696055100_7845811348955741805_n.jpg";
            uid = 100000496339789;
        },
                {
            name = "Umair Jafar";
            "pic_square" = "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xfp1/t1.0-1/c0.2.50.50/p50x50/10500337_910092152350902_4827832642500691993_n.jpg";
            uid = 100000503784242;
        }, .........
)
}

当我使用 facebook 提供的 AppID 并使用同一用户登录 facebook 时,我得到了类似的输出

 Result: {
            data =     ( )
    }



Best Answer-推荐答案


对于 2014 年 4 月 30 日之后创建的应用,端点 /me/friends 将仅返回也使用您的应用的 friend 列表。请参阅平台升级指南 [1]。

[1] https://developers.facebook.com/docs/apps/upgrading#upgrading_v2_0_user_ids

关于ios - 使用我的 FacebookAppID 在 iOS 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24781835/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4