你如何用FB.UI自动发布? [英] How do you autopublish with FB.UI?
本文介绍了你如何用FB.UI自动发布?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有stream_publish权限,但仍然会弹出一个对话框,似乎没有任何方式传递一个autopublish bool(就像之前的图api)。
编辑:还尝试使用stream_publish进行offline_access。
有关如何使此工作有任何想法? p>
function streamPublish(imageUrl,imageHref,attachName,attachHref,attachCaption){
FB.ui (
{
method:'stream.publish',
message:'',
attachment:{
name:attachName,
caption:attachCaption,
描述:(
''
),
href:attachHref,
media:[
{
type:'image',
href:imageHref,
src:imageUrl
}
]
}
},
函数(响应){
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不同的权限,以下内容将自动发布:)
code>
函数publishPost(session){
var publish = {
method:'stream.publish',
message:'正在学习如何开发Facebook应用程序。 ',
图片:'http://www.takwing.idv.hk/facebook/demoapp_jssdk/img/logo.gif',
link:'http://www.takwing.idv.hk / facebook / demoapp_jssdk /',
name:'这是我的演示Facebook应用程序(JS SDK)!',
标题:'帖子帖子',
描述:这很有趣写Facebook App!,
actions:{name:'Start Learning',link:'http://www.takwing.idv.hk/tech/fb_dev/index.php'}
} ;
FB.api('/ me / feed','POST',发布,函数(响应){
document.getElementById('confirmMsg')。innerHTML =
'一个帖子刚刚发布到你墙上的流中。';
});
};
I have the stream_publish permission but it still pops up a dialog and there doesn't seem to be any way to pass in an autopublish bool (like it was before the graph api).
EDIT: Also tried offline_access with stream_publish.
Any ideas on how to get this to work?
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
The following will autopublish if you have the permissions unlike 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.';
});
};
这篇关于你如何用FB.UI自动发布?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文