3

我尝试使用来自 facebook javascript SDK 的 FB.login 方法。在桌面浏览器上一切正常。但我对 iPad 和 Android(摩托罗拉 xoom)有疑问。

unable to post message to recipient has origin www.facebook.com

如何解决?

我正在尝试向用户墙发布消息

FB.login(function(response) {
           if (response.authResponse) {
             log("Info: login successfully");
             fbPublish();
           } else {
             log('User cancelled login or did not fully authorize.');
           }
         });

当在 fbPublish

function fbPublish(){
        log("Debug: fbPublish");
        FB.ui({
          method: "stream.publish",
          attachment: {
             name: uatitle.format(myChoice.question, myChoice.answer),
             href: document.location.href,
             media:[{"type":"image","src":"http:.....","href":document.location.href}]
          },
          action_links: [{ text: 'Vote yourself', href: document.location.href }]
         },
         function(response) {
           if (response && response.post_id) {
             log('Post was published.');
           } else {
             log('Post was not published.');
           }
         }
        );
    }

所以,正如我在桌面上所说的,一切正常/新帖子已成功发布。但我在移动设备上遇到错误

4

1 回答 1

0

您可能应该尽快离开 stream.publish,因为它将成为历史并开始使用图形 API 进行发布。

发布看起来像这样,

var params = {};
params['message'] = 'Message';
params['name'] = 'Name';
params['description'] = 'Description';
params['link'] = 'http://apps.facebook.com/my-app/';
params['picture'] = 'my-site';
params['caption'] = 'Caption';

FB.api('/me/feed', 'post', params, function(response) {
  if (!response || response.error) {
    alert('Error occured');
  } else {
    alert('Published to stream !');
  }
});

希望这可以帮助

于 2012-04-19T19:26:59.587 回答