Facebook API:朋友的使用 FQL 时 home_location 和 current_location 始终为空
我一直在从各个可能的角度看待这个问题,但我无法下定决心,也许你们可以提供帮助。我运行此查询来获取朋友的家乡和位置:
SELECT uid, name, timezone, hometown_location, current_location
FROM user WHERE uid IN ( SELECT uid2 FROM friend WHERE uid1 = me() )
并且 home_location 和 current_location 始终 为 NULL,即使它们不应该为 NULL。使用 /me/friends?fields=hometown,location,... 之类的内容具有相同的结果。
另外,查询我自己的 home_location 和 current_location 确实有效。这让我觉得我没有权限访问我朋友的家乡和家乡。位置..但如果是这种情况,不应该引发错误吗?
尽管如此,我的应用程序具有相同的权限:user_about_me、friends_about_me、user_hometown、friends_hometown、user_location & Friends_location,所以我认为这不是问题。
如果我去 http://developers.facebook.com/docs/reference/api/ 并点击 https://graph.facebook.com/me/friends?access_token= ...链接,我附加&fields=name,hometown,它有效,所以我知道它可以做到。
知道我做错了什么吗?
多谢!
曼努埃尔
I've been looking at this at every possible angle and I can't make my mind around it, maybe you guys can help. I run this query to get my friend's hometown and location:
SELECT uid, name, timezone, hometown_location, current_location
FROM user WHERE uid IN ( SELECT uid2 FROM friend WHERE uid1 = me() )
And hometown_location and current_location are always NULL, even when they shouldn't be. Using something like /me/friends?fields=hometown,location,... has the same result.
Also, querying for my own hometown_location and current_location DOES WORK. Which makes me think I don't have the permissions to access my friends' hometown & location.. but shouldn't then an error be raised, if this was the case?
Still, my app has the same permissions: user_about_me, friends_about_me, user_hometown, friends_hometown, user_location & friends_location, so I don't think this is the issue.
If I go to http://developers.facebook.com/docs/reference/api/ and click on the https://graph.facebook.com/me/friends?access_token=... link, and I append &fields=name,hometown, it works, so I know it can be done.
Any idea what could I be doing wrong?
Thanks a lot!
Manuel
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于friends_hometown,您需要friends_hometown 权限。
对于 current_location,您需要 Friends_location 权限。
一旦您确保拥有这些权限,您应该能够通过运行该查询或通过 Graph API 来获取数据 - https://graph.facebook.com/FRIEND_ID?fields=hometown,location 以及具有这些权限的 access_token。
For friends_hometown you need friends_hometown permission.
For current_location you need friends_location permission.
Once you ensure you have those permissions you should be able to get the data by running that query or through the Graph API - https://graph.facebook.com/FRIEND_ID?fields=hometown,location with an access_token having those permissions.
您使用的是 Simon Cross 的界面吗?
https://www.simoncross.com/fb/graph/
它可以帮助您了解问题所在。尝试重新生成您的access_token,您可能仍然使用旧令牌,该令牌没有friend_hometown的扩展权限。
如果您(或使用的令牌)没有访问数据的权限,API 不会抛出任何类型的错误
Are you using Simon Cross' interface?
https://www.simoncross.com/fb/graph/
It can help you understand what is the problem. Try to regenerate your access_token you might still use an old token which didn't have extended permissions for friend_hometown.
The API doesn't throw any kind of error in case you (or the token used) don't have permission to access the data