如何只获得正在使用我的应用程序的用户(朋友)? [英] How can I get only the users (friends) who are using my app?
问题描述
我有一个PhoneGap应用程序,我需要列出所有的用户的朋友,谁已经授权Facebook上的应用程序。
我目前使用 FB.api('/ me / friends?fields = installed',callbackFnc)
,但这会向我显示所有朋友,指出哪些用户已授权应用程式。当我真的想列出只授权的。
这减慢了很多加载朋友的过程。
我在这里看到了其他类似的问题,但没有人有答案。
解决方案:感谢 CBroe
我不能成功传递FQL直接到FB.api,但只使用该对象:
var apiQuery =
{
方法:'fql.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 }
。)
I have a PhoneGap app, where I need to list all the user's friends, who have authorized the application on Facebook.
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.
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){...});
解决方案 Use FQL instead:
SELECT uid, name FROM user WHERE uid IN
(SELECT uid1 FROM friend WHERE uid2 = me() ) AND is_app_user
(You can set up that query against the Graph API as well, /fql?q={query}
.)
这篇关于如何只获得正在使用我的应用程序的用户(朋友)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!