繁体   English   中英

“ fields = installed”回复我所有的朋友

[英]“fields=installed” Responding all my friends

我目前正在使用JS Facebook API开发一个应用程序(目前尚不公开,可能是相关的),我们应该是2个人使用该应用程序。

我想让所有正在使用该应用程序的朋友,但是当我这样做时:

FB.api('me/friends?fields=installed,name,id',function(response){
    console.log(response);
});

要么 :

FB.api('me/friends', { fields: 'id, installed'},function(response){
    console.log(response);
});

它返回了我所有的朋友。 你知道为什么吗?

谢谢您的帮助!

看一下这个问题的答案。 它说查询返回所有朋友。 但是, installed:true了其他字段installed:true对于使用该应用程序的朋友而言为installed:true 这意味着,如果特定条目缺少此附加字段,则该用户未使用您的应用程序。

结果将类似于:

{
  "data": [
    {
      "id": "{UID1}"
      "name": "{name1}"
    }, 
    {
      "id": "{UID2}"
      "name": "{name2}"
    }, 
    .
    . 
    .
    {
      "installed": true, 
      "id": "{UIDN}"
      "name": "{nameN}"
    }
}

因此,您可以简单地检查结果中是否存在installed:true ,以找出列表中的所有用户都在使用您的应用程序。

来源: 替换旧的GetAppUsers调用以查看使用我的应用程序的用户朋友?

您是否想念第一个/

尝试:

FB.api('/me/friends', {fields: 'id, installed'}, function(response) {
  console.log(response);
});

这篇文章也可能有帮助:

如何查找仅安装了facebook应用程序的朋友?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM