8

尝试打开提要对话框时出现以下错误。

发生错误。请稍后再试。

我需要让用户授权该应用在他们的墙上发布吗?我认为它不会,因为这不会是由应用程序本身自动发布到用户墙上的东西。另外,当我使用我的管理员帐户时,我遇到了错误。

这是我的代码:

<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>
4

2 回答 2

4

当 Facebook 发现您的应用设置与您尝试共享的 URL 之间存在一些不匹配时,这似乎会发生。我发现在我的情况下它正在发生,因为我在我的 FB.init 中设置了错误的应用程序 ID。AFAIK 您共享的 URL 必须与http://developers.facebook.com/apps中您的应用设置中的站点 URL 相对应。

有关更多提示,请参阅此线程。

于 2012-09-13T15:02:46.720 回答
2

我有同样的问题。我试图在页面加载后自动打开一个 Feed 对话框。10 次中有 9 次显示此错误。代码在$(document).readyjQuery 函数中。似乎在要执行代码的时候还没有加载一些 facebook 的东西。我把代码移到了$(window).loadblock(加载完所有页面内容后执行),问题解决了。

于 2013-08-26T19:00:37.017 回答