facebook - 尝试打开提要对话框时出错

标签 facebook dialog feed facebook-feed

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

发生错误。请稍后重试。

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

这是我的代码:

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

相关文章:

dialog - 是否可以禁用对话框上的阴影/覆盖?

Symfony 和 Twig : How to display a confirmation dialog

java - 使用 ROME 提取提要内容?

android - 在 Android 上使用 Facebook SSO 后如何向我的应用程序网络服务进行身份验证?

php - 使用 SSL 在网站上登录 Facebook 失败

javascript - 一张图片统统 : why Facebook and AddThis do that?

Android 将数据从对话框传递到弹出对话框的屏幕

ios - Facebook 在 iOS 应用程序上提供信息?

api - 从 google plus 页面获取帖子

facebook - Facebook 的 Open Graph API 和它的 Graph API 有区别吗?