【问题标题】:fb.ui feed dialog returns empty callback in chrome and mobile devicesfb.ui 提要对话框在 chrome 和移动设备中返回空回调
【发布时间】:2016-07-09 04:01:35
【问题描述】:

我在我的代码中添加了 fb.ui 提要对话框,以便在用户的 facebook 时间轴上发布一些带有图像的动态内容。

它在 Firefox 上运行良好,但我的问题是,当用户未在同一浏览器上登录 facebook 时,它第一次要求用户登录,登录后它要求用户在 facebook 上发布,发布后它在 chrome 中返回空回调和移动设备。

请大家帮忙。

FB.ui({
    method: 'feed',
    name: 'name here',
    link: 'link here',
    display: 'popup',
    picture: 'image url',
    //caption: 'Example Coupon',
    //redirect_uri: '',
    description: 'description here'
},
function(response) {
    console.log(response);//here it returns [] but post published, when user not logged onto facebook, when user already loggedin it return post_id
    if (response && response.post_id) {
        self.location.href = 'myurl.com?post_id='+response.post_id;
        //alert('Post was successfull published.');
    } else {
        alert('Post was not published. An Error occured');
    }
});

【问题讨论】:

  • 看我的回答。如果我可以问,你为什么想知道用户是否仍然发布?
  • 如果它只发布成功,那么用户将在我的场景中前进。
  • 那是不允许的。您不得以任何方式获取内容或奖励在他的墙上发布内容的用户。
  • 那里有提到吗?
  • 平台政策中有提及,您必须在创建任何应用程序之前阅读它。

标签: javascript facebook-graph-api facebook-javascript-sdk fb.ui


【解决方案1】:

如果您授权用户具有publish_actions 权限,则回调仅返回一个帖子 ID。

https://developers.facebook.com/docs/sharing/reference/feed-dialog#response

更新:publish_actions 已弃用,无法再使用 API 发布到用户个人资料。

【讨论】:

  • 我可以在 fb.ui 方法中发布操作吗?
  • 不,当然不是。您需要将 FB.login 与 scope 参数一起使用。
  • 什么是 ithis?您的应用无需请求 publish_actions 权限即可使用 Feed Dialog、Requests Dialog 或 Send Dialog
  • 是吗?当然你不需要它。你有什么问题?
  • 但事实并非如此,这就是我在回答中的意思。如果您使用 publish_actions 授权用户,您只会获得一个帖子 ID。就是这样。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-06-16
  • 1970-01-01
  • 1970-01-01
  • 2012-02-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多