<分区>
我正在为 iOS 应用构建 Rails 后端。后端需要与 Facebook 接口(interface)以获取和使用每个用户的 Facebook 好友。
但是 Facebook 的“好友”请求返回的是空的。
我实际上是在提出以下请求:
curl https://graph.facebook.com/[FILTERED_USER_ID_FOR_APP]?fields=friends&access_token=[FILTERED]&debug=all
我查看了大量关于此的 StackOverflow 帖子(this one、this one、this one 等等),但没有找到相同的问题或适合的解决方案。
我似乎已经正确设置了权限。在 Rails 应用程序和用户通过 iPhone 应用程序进行身份验证时,我都将 user_friends
设置为权限之一,事实上,当有人现在注册时,它会要求他们确定用户好友权限。
但是当我实际请求他们的 friend 时,我得到一个回复告诉我有很多 friend ,但没有返回任何一个。以下回复适用于肯定在该应用上有 friend 的用户。
{
"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"
}
]
}
}
让我感到困惑的是,a) App ID/User ID/Access Tokens 似乎是正确的,因为我可以获得基本的个人资料信息,而b)我可以没有收到一个错误,告诉我该请求没有适当的权限。如果我在 the explorer 上没有权限提出类似的请求,它返回相关的调试说明:
{
"message": "The field 'friends' is only accessible on the User object after the user grants the 'user_friends' permission.",
"type": "warning"
}
如果我在资源管理器中使用正确的权限,它会返回一个好友列表(在data
数组中)。
所以它不是似乎是权限问题,但请求返回一个空的好友列表。有什么想法吗?