Wednesday 15 September 2010

Facebook Graph Api v2.0+ - /me/friends returns empty, or only friends who also use my app -



Facebook Graph Api v2.0+ - /me/friends returns empty, or only friends who also use my app -

i trying friend name , ids graph api v2.0, info returns empty:

class="lang-js prettyprint-override">{ "data": [ ] }

when using v1.0, ok next request:

class="lang-c prettyprint-override">fbrequest* friendsrequest = [fbrequest requestformyfriends]; [friendsrequest startwithcompletionhandler: ^(fbrequestconnection *connection, nsdictionary* result, nserror *error) { nsarray* friends = [result objectforkey:@"data"]; nslog(@"found: %i friends", friends.count); (nsdictionary<fbgraphuser>* friend in friends) { nslog(@"i have friend named %@ id %@", friend.name, friend.id); } }];

but cannot friends!

in v2.0 of graph api, calling /me/friends returns person's friends utilize app.

in addition, in v2.0, must request user_friends permission each user. user_friends no longer included default in every login. each user must grant user_friends permission in order appear in response /me/friends. see the facebook upgrade guide more detailed information, or review summary below.

if want access list of non-app-using friends, there 2 options:

if want allow people tag friends in stories publish facebook using app, can utilize /me/taggable_friends api. use of endpoint requires review facebook , should used case you're rendering list of friends in order allow user tag them in post.

if app game , game supports facebook canvas, can utilize /me/invitable_friends endpoint in order render a custom invite dialog, pass tokens returned api the standard requests dialog.

in other cases, apps no longer able retrieve total list of user's friends (only friends have authorized app using user_friends permission). this has been confirmed facebook 'by design'.

for apps wanting allow people invite friends utilize app, can still utilize send dialog on web or new message dialog on ios , android.

update: facebook have published faq on these changes here: https://developers.facebook.com/docs/apps/faq explain options available developers in order invite friends etc.

facebook facebook-graph-api facebook-ios-sdk facebook-graph-api-v2.0

No comments:

Post a Comment