问题
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