我正在尝试在javascript sdk中获取应用用户。 为什么这不起作用?
var q = FB.Data.query('SELECT uid FROM user WHERE uid IN '
+ '(SELECT uid2 FROM friend WHERE uid1 = me()) AND is_app_user = 1');
q.wait(function(resp) {
console.log(resp);
}
);
返回[]
但是效果很好:
var q = FB.Data.query('SELECT uid2 FROM friend WHERE uid1 = me()');
q.wait(function(resp) {
var l = [];
for (var i in resp) {
l.push(resp[i].uid2)
}
var fql = 'SELECT uid FROM user WHERE uid IN (' + l.join(',') + ') and is_app_user = 1';
var q1 = FB.Data.query(fql);
q1.wait(function(resp) {
console.log(resp);
});
}
);
第二个语句的问题是将所有朋友加载到浏览器中并再发出一个请求。为什么第一个声明不起作用?
答案 0 :(得分:3)
尝试将is_app_user视为布尔值: (适用于我只使用fql)
var q = FB.Data.query('SELECT uid FROM user WHERE uid IN' +'(SELECT uid2 FROM friend WHERE uid1 = me())AND is_app_user');
答案 1 :(得分:1)