问题
A while ago, I used to take the friends of mine using Graph API in this way (using Graph API Explorer):
/me/friends
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.
So, how can I do the same thing with the 2.0 version?
回答1:
In v2.0 of the API, /me/friends
returns friends who also have logged into the app.
Apps created on or after April 30th 2014 must use Graph API v2.0; they're not able to call Graph API v1.0.
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.
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.
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.
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
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
来源:https://stackoverflow.com/questions/23400204/get-facebook-friends-with-graph-api-v-2-0