【问题标题】:Getting error when trying to open a feed dialog尝试打开提要对话框时出错
【发布时间】:2011-12-31 16:19:05
【问题描述】:

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

发生错误。请稍后再试。

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

这是我的代码:

<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 dialog feed facebook-feed


【解决方案1】:

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

【讨论】:

    【解决方案2】:

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

    有关更多提示,请参阅this thread

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-13
      • 2023-04-04
      • 2021-10-28
      • 1970-01-01
      • 2019-08-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多