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

发布于 2024-12-21 13:31:32 字数 1122 浏览 2 评论 0原文

我正在使用 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() 永远不会发生。控制台一片空白。

I'm playing around with Facebook's JS SDK and FQL, trying to get results for some queries, the first two queries I try (fql) work perfectly fine, the latter half don't work.

If I call FB.getAccessToken() and retrieve my current session's access token, then use that access token to ping the FQL endpoint it works:

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

Anyone know why it doesn't work when using the 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);

        });

Edit

To be a little more clear, the console.log(rows); call in .wait() never happens. The console is blank.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

迷路的信 2024-12-28 13:31:32

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

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

                 });


            });

Hello you must write some like this:

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

                 });


            });
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文