授予 publish_actions

Grant publish_actions

我想分享一些url到facebook,代码在这里

  FB.ui(
  {
     method: 'share',
     href: "http://SomeWebPage"
  }, 
  function (response) {
  });

Share Dialog 的文档中写了响应数据

Only available if the user is logged into your app using Facebook and has granted publish_actions. If present, this is the ID of the published Open Graph story.

假设用户没有登录 Facebook 并点击我的分享按钮 我看到的是

用户即将登录我的应用程序"Pay oneerDev"

但是上面提到的publish_actions到底有没有定义呢?
用户如何同意此操作?

然后当用户分享时,我总是得到“[]”作为响应数据而不是一些 id,没有办法知道用户是否实际分享或取消或发生了一些错误。

对于 publish_actions,您需要实施 Login, and you would need to go through Login Review with that permission before it´s available for everyone. Just to know if something was shared or not will definitely not get that permission approved, because Share Gating is not allowed according to the platform policy:

4.5: Only incentivize a person to log into your app, enter a promotion on your app’s Page, or check-in at a place. Don’t incentivize other actions.

顺便说一句,为了使共享对话框正常工作,用户只需登录 Facebook,而不是您的应用程序。确保您了解其中的区别。