Friends and Friendlists in Facebook

混江龙づ霸主 提交于 2019-12-11 08:09:15

问题


How do I find out if a friend is in for example the aquaintances or good friends or another custom friend_list with the JS SDK. Im working with a singlepage javascript application in phonegap.

The main issue is that I need different sets of data, that aren't useable outside of the callback function.

I tried to query all my friend lists like so,

FB.api('me/friendlists'){
});

And all my friends like so

 FB.api('me/friends', function(friends){
 friends.data.forEach(function(friend){
 });
 });

but they both use callback functions, i need to compare the 2 results and add a property listname and/or id to the friends result.


回答1:


With the read_friendlists Permission you can access a user's friends lists.

Then, make a call to /[USER_ID]/friendlists to get the friend list List ids, then a call to /[FRIEND LIST ID] to get the list of friends on that list.

You can then store those and check if a specific uid is on one of the lists



来源:https://stackoverflow.com/questions/11187988/friends-and-friendlists-in-facebook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!