代码之家  ›  专栏  ›  技术社区  ›  baloo

Facebook的新javascript sdk stream.publish坏了?

  •  0
  • baloo  · 技术社区  · 15 年前

    使用fb.ui(方法:“stream.publish”…) 它无法接受我的附件媒体抱怨它应该是一个数组(虽然它是)。

    旧的API(fb.connect.streampublish)接受了这种格式,而且所有其他选项似乎都有效。 我发现facebook文档一团糟,有人用新版本处理了这个?

    整个帖子创建如下:

                var attachment = {media: new Array({type:'image',
                                             src:'http://xxxxxxx' + baseurl + 'img/facebook-share_big.png',
                                             href:'http://xxxxxxx' + baseurl}),
                                 name: 'xxxxxxx',
                                 description: message,
                                 href: 'http://xxxxxxx' + baseurl};
                var action = [{text: 'xxxxxxx', href: 'http://xxxxxxx' + baseurl}];
                FB.ui({
                    method: 'stream.publish',
                    message: 'xxxxxxx',
                    attachment: attachment,
                    action_links: action,
                    user_message_prompt: 'xxxxxxx'
                });
    
    1 回复  |  直到 15 年前
        1
  •  1
  •   kgretk    15 年前

    看到这个帖子: http://forum.developers.facebook.com/viewtopic.php?pid=237121#p237121

    建议的解决方案是:

        ......
    window.fbAsyncInit = function() {
        FB.JSON.stringify = function (value) { return JSON.encode(value);};
        FB.init({
    ......
    

    它对我很有用(MooTools在FF中还没有检查其他浏览器)

    推荐文章