简体   繁体   English

fb.ui供稿对话框在Chrome和移动设备中返回空的回调

[英]fb.ui feed dialog returns empty callback in chrome and mobile devices

I have added fb.ui feed dialog in my code to post some dynamic content with images on user's facebook timeline. 我在代码中添加了fb.ui feed对话框,以便在用户的Facebook时间轴上发布带有图片的动态内容。

It is working fine on firefox but my problem is when user is not logged into facebook on same browser first time it asks user to get login and after login it asks user to post on facebook, after posting it returns empty callback in chrome and mobile devices. 它在Firefox上工作正常,但是我的问题是,当用户第一次未在同一浏览器上登录Facebook时,它要求用户登录,登录后要求用户在Facebook上发布,发布后在chrome和移动设备上返回空回调。

Anyone help please. 有人帮忙。

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');
    }
});

The callback only returns a Post ID if you authorize the user with the publish_actions permission. 如果您授权用户具有publish_actions权限,则回调仅返回Post ID。

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

Update: publish_actions is deprecated, there is no way to post to a user profile with the API anymore. 更新:不建议使用publish_actions,无法再使用该API发布到用户个人资料。

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

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