Facebook JS SDK FB.Data.Query& query.wait方法不返回某些FQL查询的结果

时间:2011-12-17 02:48:54

标签: facebook facebook-graph-api facebook-javascript-sdk facebook-fql

我正在玩Facebook的JS SDK和FQL,试图获得一些查询的结果,我尝试的前两个查询(fql)工作得很好,后半部分不起作用。

如果我调用FB.getAccessToken()并检索当前会话的访问令牌,则使用该访问令牌对其工作的FQL端点执行ping操作:

https://api.facebook.com/method/fql.query?query=SELECT+name,+is_app_user+FROM+user+WHERE+uid+IN+(SELECT+uid2+FROM+friend+WHERE+uid1+=+ 504405294)&access_token=#############&format=json

任何人都知道为什么它在使用FB JS SDK时不起作用?

    //  var fql = 'SELECT pic_square, uid FROM user WHERE uid = 504405294 OR uid = 100002624783324 OR uid = 1634269784 OR uid = 100002917463525';
        var fql = 'SELECT name, pic_square, sex FROM user WHERE uid = 100002624783324';
    //  var fql = 'SELECT name FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())'; //ORDER BY is_app_user DESC LIMIT 0, 1000';
    //  var fql = 'SELECT uid2 FROM friend WHERE uid1 = 504405294';

        console.log(fql);

        var query = FB.Data.query(fql);
        query.wait(function(rows){
            console.log(rows);

        });

修改

要更清楚一点,console.log(行);呼叫.wait()永远不会发生。控制台是空白的。

1 个答案:

答案 0 :(得分:1)

你好,你必须写一些这样的:

FB.api('/me', function(user) {   

      this.query =  FB.Data.query("SELECT name, pic_square, sex FROM user WHERE uid =me()", user.id);

                this.query.wait(function(rows) {

                   console.log(rows); 

                 });


            });