使用 Graph API v.2.0 获取 Facebook 好友 [英] Get facebook friends with Graph API v.2.0

查看:30
本文介绍了使用 Graph API v.2.0 获取 Facebook 好友的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

前段时间,我用Graph API的方式(使用Graph API Explorer)带我的朋友:

A while ago, I used to take the friends of mine using Graph API in this way (using Graph API Explorer):

/me/friends

一切都很完美,但现在有了 2.0 版本,我发现这种方式对于没有使用(通过 Facebook 登录)发出请求的应用程序的朋友不起作用,如果我将 Graph API Explorer 切换到 1.0 版本,它起作用了.

Everything was perfect but now, with 2.0 version, I saw that this way does not function for friends who didn't use (via Facebook Login) the app making the request and, if I switch Graph API Explorer to 1.0 version, it functions.

那么,我如何用 2.0 版本做同样的事情?

So, how can I do the same thing with the 2.0 version?

推荐答案

在 API v2.0 中,/me/friends 返回也已登录应用程序的朋友.

In v2.0 of the API, /me/friends returns friends who also have logged into the app.

2014 年 4 月 30 日或之后创建的应用必须使用 Graph API v2.0;他们无法调用 Graph API v1.0.

Apps created on or after April 30th 2014 must use Graph API v2.0; they're not able to call Graph API v1.0.

对于 4 月 30 日之前活跃的应用,这些应用可以调用 Graph API v2.0 或 Graph API v1.0,但 Graph API v1.0 将于 2015 年 4 月 30 日弃用.

For apps which were active before April 30th, these apps can call either Graph API v2.0 or Graph API v1.0, but Graph API v1.0 will be deprecated on April 30th 2015.

请注意,如果用户通过 v2.0 登录应用,并且您调用 /v1.0/me/friends,这仍然只会返回使用应用的朋友.

Note that if a user logs into an app via v2.0, and you call /v1.0/me/friends, this will still only return app-using friends.

如果您想让您的用户在您发布到 Facebook 的快拍中标记人物时,您想要访问不使用应用的好友,您可以使用 /me/taggable_friends API.

If you want to access non-app-using friends in the case where you want to let your users tag people in stories you publish to Facebook, you can use the /me/taggable_friends API.

如果您想邀请人们使用您的应用,游戏可以使用 /me/invitable_friends 端点来呈现自定义邀请选择器.然后可以在请求对话框中使用此 API 返回的令牌.请参阅 https://developers.facebook.com/docs/games/invitable-friends/v2.0https://developers.facebook.com/docs/games/requests/v2.0

In the case where you want to invite people to use your app, Games can use the /me/invitable_friends endpoint in order to render a custom invite selector. The tokens returned by this API can then be used in the Requests Dialog. See https://developers.facebook.com/docs/games/invitable-friends/v2.0 and https://developers.facebook.com/docs/games/requests/v2.0

对于希望允许人们邀请朋友使用应用程序的非游戏,您仍然可以使用 在网络上发送对话框iOS 上的消息对话框a> 和 Android

For non-games wanting allow people to invite friends to use an app, you can still use the Send Dialog on Web or the Message Dialog on iOS and Android

这篇关于使用 Graph API v.2.0 获取 Facebook 好友的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆