尝试打开提要对话框时出现以下错误。
发生错误。请稍后重试。
我需要让用户授权应用程序在他们的墙上发帖吗?我当时认为它不会,因为这不会由应用程序本身自动发布到用户的墙上。另外,我在使用我的管理员帐户时遇到错误。
这是我的代码:
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'xxxxxxxxxxxxxxx', // App ID
channelURL : 'http://localhost/foods/channel.html', // 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
});
// Additional initialization code here
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
function postToFeed() {
// calling the API ...
var obj = {
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 users.'
};
function callback(response) {
document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
}
FB.ui(obj, callback);
}
</script>
<a href="javascript:void();" onclick="postToFeed();"><img src="images/share.gif" /></a>
最佳答案
当 Facebook 发现您的应用程序设置与您尝试共享的 URL 不匹配时,就会发生这种情况。我发现在我的案例中发生这种情况是因为我在 FB.init 中设置了错误的应用程序 ID。据我所知,您共享的 URL 必须与您在 http://developers.facebook.com/apps 中的应用设置中的站点 URL 相对应.
参见 this thread获取更多提示。
关于facebook - 尝试打开提要对话框时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8173321/