Facebook Api获取好友总数,但不是好友数据

Facebook Api getting total count of friends, but not friends data

本文关键字:好友 数据 Api 获取 Facebook      更新时间:2023-09-26

嗨,我正在使用Facebook API javascript SDK,并尝试登录用户朋友数据这是我正在使用的范围

    FB.login(function(response) {
          statusChangeCallback(response);
          }, {
            scope:'publish_actions,user_friends,public_profile',
            return_scopes: true
    });
 FB.api('/me', function(response) {
    $textInput = document.getElementById("searchText");
        var request =  jQuery.ajax({
                        type: "POST",
                        url: "/logged/ajax/facebook",
                        data: response });
        request.done(function( $data ) {
            jQuery(".loadingContent").css( "display", "none" );
            if($data == "success"){
               FB.api('/me/friends', function(data) {
                 console.log(data);
                });
            } else {
                alert($data);
            }
        });
         request.fail(function( jqXHR, textStatus ) {
         });
});

但它回报了我

({"data":[],"summary":{"total_count":79}})

数据总是空的,尽管我得到了我的Facebook好友总数

从 v2.0 开始,您也只能获得授权您应用程序的朋友。

查看更新日志以获取更多信息:https://developers.facebook.com/docs/apps/changelog

这个问题已经在其他几个线程中得到了回答:

  • 使用 Graph API v.2.0 获得 Facebook 好友
  • Facebook Graph API v2.0+ -/me/friends 返回空,或仅返回也使用我的应用的朋友
  • 使用Facebook Graph API获取所有用户朋友 - Android