使用 fb_graph Ruby gem 从 Facebook 检索好友位置
我正在尝试使用 gem 检索用户所有朋友的位置:fb_graph。 (版本 1.7.2)
我的权限是:publish_stream、read_friendlists、offline_access、friends_location、user_location
我已经对用户进行了身份验证并存储了离线访问令牌及其 Facebook ID。
user = User.find_by_email("[email protected]")
facebook_user = FbGraph::User.fetch(user.facebook_identifier, :access_token => user.facebook_access_token)
facebook_user.friends.map(&:location) => [nil, nil...]
当我检查 Facebook 内部的权限时,它说我可以访问好友位置:
我的问题是,当我尝试获取朋友的位置时,它总是返回零。我已经正确设置了权限,并且我知道该位置对于每个人来说都不应该为零。
有人对如何获取朋友位置有任何建议或指示吗?
谢谢!
I'm trying to retrieve the locations of all of a user's friends using the gem: fb_graph. (version 1.7.2)
My permissions are: publish_stream,read_friendlists,offline_access,friends_location,user_location
I've already authenticated the user and stored the offline access token and their facebook id.
user = User.find_by_email("[email protected]")
facebook_user = FbGraph::User.fetch(user.facebook_identifier, :access_token => user.facebook_access_token)
facebook_user.friends.map(&:location) => [nil, nil...]
When I check the permissions from within Facebook it says I have access to friend locations:
My problem is when I try and get the locations of my friends it always returns nil. I have permissions setup correctly and I know the location should not be nil for everybody.
Does anybody have any suggestions or pointers on how to go about getting friend locations?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
API 权限不会覆盖用户的隐私设置。您的 Facebook 用户隐私设置是否可能阻止此操作?或者也许您所有朋友的隐私设置都阻止了此操作?
API permissions do not override a user's privacy settings. Is it possible that your facebook user privacy settings block this? Or perhaps all of your friends' privacy settings block this?
所以我能够获得我需要的信息。您必须在每次调用后调用 fetch ,因此
这会获取我想要的数据,但是迭代所有内容并对每条数据进行单独调用的速度相当慢,因此我重构为仅使用直接 FQL 返回我需要的所有数据。
So I as able to get the information I needed. You have to call fetch after each call, so
This gets me the data that I want, however it is rather slow iterating over everything and doing an individual call for each piece of data so I refactored to just use straight FQL to return all the data that I needed.