Facebook好友请求返回空 - 尽管权限

Sas*_*sha 2 facebook facebook-graph-api facebook-graph-api-v2.7

我正在为iOS应用程序构建Rails后端.后端需要与Facebook连接以获取和使用每个用户的Facebook好友.

但Facebook'朋友'的要求是空的.

我基本上提出以下要求:

curl https://graph.facebook.com/[FILTERED_USER_ID_FOR_APP]?fields=friends&access_token=[FILTERED]&debug=all
Run Code Online (Sandbox Code Playgroud)

我已经看了很多关于这个的StackOverflow帖子(这个,这个,这个,还有更多),但没有找到相同的问题或适合的解决方案.

我似乎已正确设置权限.在Rails应用程序和用户通过iPhone应用程序进行身份验证时,我都设置user_friends为权限之一,事实上,当有人注册时,它会要求他们确定用户朋友的权限.

但是,当我居然要求他们的朋友,我得到回应,告诉我,有很多朋友,但没有返回任何人.以下响应适用于在应用上肯定有朋友的用户.

{
  "data":[],
  "summary": {
    "total_count": 419 
  },
  "__debug__": {
    "messages": [
       { 
        "link": "https:\/\/developers.facebook.com\/docs\/apps\/versions\/", 
        "message": "No API version was specified. This request defaulted to version v2.7.","type":"warning"
       },        
       {
         "link": "https:\/\/developers.facebook.com\/docs\/apps\/changelog#v2_0",
         "message": "Only friends who installed this app are returned in API v2.0 and higher. total_count in summary represents the total number of friends, including those who haven't installed the app.",
         "type": "info"
       }
     ]
   }
 }
Run Code Online (Sandbox Code Playgroud)

令我困惑的是a)应用程序ID /用户ID /访问令牌似乎是正确的,因为我可以获得基本的配置文件信息,以及b)没有收到错误,告诉我该请求没有适当的权限.如果我在资源管理器上没有权限情况下发出类似请求,则会返回相关的调试说明:

  {
    "message": "The field 'friends' is only accessible on the User object after the user grants the 'user_friends' permission.",
    "type": "warning"
  }
Run Code Online (Sandbox Code Playgroud)

如果我在资源管理器中使用正确的权限进行创建,则会返回一个朋友列表(在data数组中).

所以它似乎不是权限问题,但请求返回一个空的好友列表.有任何想法吗?

Sas*_*sha 5

在Igy的帮助下(指出这个答案),我找到了我的问题的具体答案,这似乎值得在这里补充.

问题是新的2.0+ API版本只返回朋友:

  1. 谁在应用程序上
  2. 谁同意了user_friends自己的权限.

1都被弄明白了,但因为我还在测试应用程序,而且还没有人接受权限,我的测试用户是唯一接受权限的人.没有人接受过user_friends,所以没有人出现在测试用户的朋友面前.让测试用户的朋友添加权限修复了问题,将该朋友添加到返回的朋友列表中.