fb.ui feed对话框返回chrome和移动设备中的空回调

时间:2016-07-09 04:01:36

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

我在我的代码中添加了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');
    }
});

1 个答案:

答案 0 :(得分:2)

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

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