使用Facebook API发布到墙上

时间:2011-07-20 17:12:27

标签: facebook facebook-graph-api

我希望用户能够从我的网站发布到他们的墙上。当我点击我提交给FB链接时,Facebook弹出窗口只显示“发生错误。请稍后再试。” Firebug只是说错误是“图像损坏或截断:”。如果尝试任何FB方法,如FB.login或FB.getLoginStatus,我会得到同样的消息。我知道这不是很重要,但是有没有人知道出了什么问题,或者有更好的方法来调试它?

function load_FB(){
  FB.init({
    appId  : xxxxxxxxxxxxxxxx,
    status : true,
    cookie : true, 
    xfbml  : true  
  });
}

var publish = {method: 'feed', message: 'my message'};
function publish_wall_post()
{
  FB.ui(publish);
}

2 个答案:

答案 0 :(得分:3)

thinkdiff有一个关于如何在墙上发布的很好的工作示例。 http://thinkdiff.net/facebook/graph-api-iframe-base-facebook-application-development/

答案 1 :(得分:3)

查看https://developers.facebook.com/docs/reference/javascript/FB.ui/

处的FB.ui文档
 FB.ui(
   {
     method: 'feed',
     name: 'Facebook Dialogs',
     link: 'https://developers.facebook.com/docs/reference/dialogs/',
     picture: 'http://fbrell.com/f8.jpg',
     caption: 'Reference Documentation',
     description: 'Dialogs provide a simple, consistent interface for applications to interface with users.',
     message: 'Facebook Dialogs are easy!'
   },
   function(response) {
     if (response && response.post_id) {
       alert('Post was published.');
     } else {
       alert('Post was not published.');
     }
   }
 );