如何才能获得正在使用我的应用的用户(朋友)? [英] How can I get only the users (friends) who are using my app?
问题描述
我有一个PhoneGap应用程序,我需要列出所有在Facebook上授权应用程序的用户的朋友。
I have a PhoneGap app, where I need to list all the user's friends, who have authorized the application on Facebook.
我正在使用 FB.api('/ me / friends?fields = installed',callbackFnc)
,但这显示我所有的朋友,指出他们已经授权了该应用。当我真的想要列出只有授权的。
这样做会减慢加载朋友的过程。
I'm currently using FB.api('/me/friends?fields=installed', callbackFnc)
, but this shows me all friends, pointing which of them have authorized the app. When I really wanted to list only the authorized ones.
This slows a lot the process of loading friends.
我在这里看到其他类似的问题,但没有一个答案。
I saw other similar questions here, but none of them had the answer.
解决方案:感谢 CBroe
我无法将该FQL直接传递给FB.api,但只使用该对象:
SOLUTION: Thanks to CBroe
I couldn't have sucess passing the FQL directly to FB.api, but only using that object:
var apiQuery =
{
method: 'fql.query',
query: 'SELECT uid, name FROM user WHERE uid IN (SELECT uid1 FROM friend WHERE uid2 = me() ) AND is_app_user'
}
FB.api(apiQuery, function(response){...});
推荐答案
使用FQL:
SELECT uid, name FROM user WHERE uid IN
(SELECT uid1 FROM friend WHERE uid2 = me() ) AND is_app_user
(您可以根据Graph API设置该查询, / fql?q = {query }
。)
(You can set up that query against the Graph API as well, /fql?q={query}
.)
这篇关于如何才能获得正在使用我的应用的用户(朋友)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!