Facebook的新Javascript SDK stream.publish坏了吗?

时间:2010-06-02 12:14:38

标签: javascript facebook

使用FB.ui({method:'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 个答案:

答案 0 :(得分:1)

看这篇文章: 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中,还没有检查其他浏览器)