javascript - FB 页面上的地理定位帖子不起作用

标签 javascript facebook facebook-graph-api

我能够让我的帖子显示正确的链接、状态、图像等,但我似乎无法让定位正常工作。这是我在我的 json 定位字段中发布的内容:

{
  ...
  message: "test status message",
  targeting: "{"cities":[{"name":"Austin, TX","key":2525495,"subtext":"TX, United States"},    {"name":"San Marcos, TX","key":2529779,"subtext":"TX, United States"},{"name":"Round Rock,   TX","key":2529681,"subtext":"TX, United States"},{"name":"Cedar Park, TX","key":2526105,"subtext":"TX, United States"},{"name":"Georgetown, TX","key":2527173,"subtext":"TX, United States"},{"name":"Blanco, TX","key":2525726,"subtext":"TX, United States"}]}",
  ...
}

我在帖子中看到的结果是:

Shared with: Aixàs, Andorra, Aixàs, Andorra, Aixàs, Andorra, Aixàs, Andorra, Aixàs, Andorra, Aixàs, Andorra
News feed targeting: Aixàs, Andorra, Aixàs, Andorra, Aixàs, Andorra, Aixàs, Andorra, Aixàs, Andorra, Aixàs, Andorra

在另一个测试中,我尝试发送以下内容:

{
...
targeting: "{'countries':['US'],'regions':[{'key': 25,'name': 'Massachusetts','country_code': 'US'}]}"
...
}

虽然发布了帖子,但结果一无所获:

Shared with:

任何人都可以阐明这一点。第一个很有趣,因为我试图瞄准六个城市并获得安道尔城市的六个副本。我不太确定我做错了什么。我查看了所有文档,甚至从 autocomplte api 复制了我的数据。

如有任何帮助,我们将不胜感激。

谢谢, 大卫

最佳答案

看来您现在必须在帖子中使用 feed_targeting 参数而不是 targeting 参数。 targeting 现在用于被称为“门控”的东西,它不仅针对指定区域,而且限制他们与区域外的任何人重新分享帖子的能力(通常用于区域法律/权利顾虑)。

此外,除非您使用“页面访问 token ”而不是“用户访问 token ”,否则您仍然无法定位帖子,如前所述 here :

To perform the following operations as a Page, and not the current user, you must use the Page's access token, not the user access token commonly used for reading Graph API objects. This access token can be retrieved by issuing an HTTP GET to /USER_ID/accounts with the manage_pages permission. This will return a list of Pages (including application profile Pages) to which the user has administrative access, along with access_tokens for those Pages. Alternatively, you can get a page access token for a single, specific, page by issuing an HTTP GET to /PAGE_ID?fields=access_token with the manage_pages permission, as described above. Publishing to a Page also requires the publish_stream permission, unless otherwise noted.

关于javascript - FB 页面上的地理定位帖子不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13978495/

相关文章:

javascript - 当您声明/调用属性时,括号是什么意思?

Facebook:发送应用邀请

asp.net - 如何将查询字符串添加到 facebook 登录按钮的 redirect_uri?

facebook - 返回用户 token 而不是访问 token

facebook - 缓存http ://graph. facebook.com/[UID]/图片调用?

javascript - 打开带有发布数据的弹出窗口

javascript - Feathers调用自定义API方法

java - Facebook:如何使用 Graph Api 获取好友签到?

javascript - 为什么 JavaScript 中的这种分割不起作用?

ios - 如何将 Facebook 的 Buck Build 安装到现有的 Xcode 项目中?