我正在使用Facebook的JS SDK和FQL,试图获取某些查询的结果,我尝试的前两个查询(fql)可以正常工作,而后一半则无法工作。

如果我调用FB.getAccessToken()并检索我当前会话的访问令牌,则使用该访问令牌来ping通它的FQL端点:

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(rows);在.wait()中调用永远不会发生。控制台为空白。

最佳答案

您好,您必须这样写:

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);

                 });


            });

关于facebook - Facebook JS SDK FB.Data.Query和query.wait方法未返回某些FQL查询的结果,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8542230/

10-10 14:56