发布到登录用户的Facebook Feed

时间:2012-09-04 15:57:24

标签: facebook facebook-wall

我有一个在SilverLight中完成的FaceBook游戏。它从SilverLight HTML桥接器调用JavaScript。我不想要一个要求用户发表评论的用户界面,我只想让他们从SilverLight应用程序传递的分数在他们的Feed上发布。以下代码不执行任何操作。它不会抛出异常,但却什么都不做。

您可以发送任何帮助,以解释如何解决此问题,以便将其发布到没有用户界面的用户Feed,这将非常感谢。

function PostToFeed(strCaption) 
{

    function callback(response) 
    {
    }

    var obj = 
    {
        method: 'stream.publish',
                    // was using method: 'feed',
        link: 'https://apps.facebook.com/blackjackguru/',
        picture: 'https://metamorphosisapps.com/blackjackguru/BlackjackIcon.gif',
        name: 'Blackjack Guru Accomplishment',
        caption: strCaption,
        message: 'I love this game!',
        description:  'Play blackjack with the best blackjack game on FaceBook.'
    };

    FB.ui(obj, callback);
}

1 个答案:

答案 0 :(得分:1)

var obj = 
    {           
        link: 'https://apps.facebook.com/blackjackguru/',
        picture: 'https://metamorphosisapps.com/blackjackguru/BlackjackIcon.gif',
        name: 'Blackjack Guru Accomplishment',
        caption: strCaption,
        message: 'I love this game!',
        description:  'Play blackjack with the best blackjack game on FaceBook.'
    };

FB.api('/me/feed', 'post', obj , function(response) {
  if (!response || response.error) {
    alert('Error occured');
  } else {
    alert('Post ID: ' + response.id);
  }
});
你试过这个吗?这只是发布到用户Feed没有任何问题:)