我具有stream_publish权限,但它仍会弹出一个对话框,似乎没有任何方法可以传递自动发布的 bool 值(就像在图形api之前一样)。
编辑:还尝试了使用stream_publish的offline_access。
关于如何使它起作用的任何想法?
function streamPublish(imageUrl, imageHref, attachName, attachHref, attachCaption) {
FB.ui(
{
method: 'stream.publish',
message: '',
attachment: {
name: attachName,
caption: attachCaption,
description: (
''
),
href: attachHref,
media: [
{
type: 'image',
href: imageHref,
src: imageUrl
}
]
}
},
function(response) {
if (response && response.post_id) {
//alert('Post was published.');
} else {
//alert('Post was not published.');
}
}
);
}
最佳答案
http://www.takwing.idv.hk/tech/fb_dev/jssdk/learning_jssdk_12.html
如果您具有与FB.UI不同的权限,则以下内容将自动发布:)
function publishPost(session) {
var publish = {
method: 'stream.publish',
message: 'is learning how to develop Facebook apps.',
picture : 'http://www.takwing.idv.hk/facebook/demoapp_jssdk/img/logo.gif',
link : 'http://www.takwing.idv.hk/facebook/demoapp_jssdk/',
name: 'This is my demo Facebook application (JS SDK)!',
caption: 'Caption of the Post',
description: 'It is fun to write Facebook App!',
actions : { name : 'Start Learning', link : 'http://www.takwing.idv.hk/tech/fb_dev/index.php'}
};
FB.api('/me/feed', 'POST', publish, function(response) {
document.getElementById('confirmMsg').innerHTML =
'A post had just been published into the stream on your wall.';
});
};
关于javascript - 如何使用FB.UI自动发布?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/4396269/