我正在使用下面的代码,就像从https://developers.facebook.com/docs/reference/dialogs/feed/发布到用户墙一样。然而,这个帖子没有出现在墙上。有什么我想念的吗?
FB.ui({
method: 'feed',
link: 'https://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
name: 'Facebook Dialogs',
caption: 'Reference Documentation',
description: 'Using Dialogs to interact with people.'
}, function(response){});
我已加载Javascript SDK connect.facebook.net/en_US/all.js
。我是否必须添加以下代码?
FB.init({
appId: 'xxxXXxxx',
status: true,
cookie: true,
xfbml: true
});
答案 0 :(得分:0)
有很多原因导致它无效。你提供的信息真的不够,所以我要继续并列出一些可能不起作用的原因:
FB.init()
中的“xxxXXxxx”是在Facebook上创建应用时生成的应用ID。 最后,您的代码应如下所示:
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
appId : 'xxxXXXxxx', // App ID
channelURL : '../../Vendor/channel.php', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
oauth : true, // enable OAuth 2.0
xfbml : true // parse XFBML
});
function postFeed(){
FB.ui({method: 'feed',
picture: 'https://www.example.com/img/fb-post.jpg',
link: "http://www.example.com/",
caption: "example.com",
description: "a small description associated with your post",
}, requestCallback);
}
// Load the SDK Asynchronously
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol
+ '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>