【问题标题】:Facebook API share showing error "Sorry, something went wrong. We're working on getting this fixed as soon as we can."Facebook API 共享显示错误“抱歉,出了点问题。我们正在努力尽快解决这个问题。”
【发布时间】:2017-02-05 01:00:05
【问题描述】:

我正在使用Facebook 开发共享功能。登录功能运行良好。但是当我尝试使用示例代码分享某些内容时,它会显示为

抱歉,出了点问题。

我们正在努力尽快解决此问题。

我使用的代码是

$('#fb_test').on('click', function(e){
    e.preventDefault();
    FB.ui(
    {
        method: 'feed',
        name: 'This is the content of the "name" field.',
        link: 'URL which you would like to share ',
        picture: "URL of the image which is going to appear as thumbnail image in share dialogbox",
        caption: 'Caption like which appear as title of the dialog box',
        description: 'Small description of the post',
        message: ''
    }
    );
});

【问题讨论】:

    标签: facebook-graph-api facebook-javascript-sdk


    【解决方案1】:

    使用此代码代替您的代码可以正常工作。

    首先在body标签之后引用这个fb脚本

    <script>
        window.fbAsyncInit = function() {
            FB.init({
                appId      : 'app_id',
                xfbml      : true,
                version    : 'v2.8'
            });
            FB.AppEvents.logPageView();
        };
    
        (function(d, s, id){
            var js, fjs = d.getElementsByTagName(s)[0];
            if (d.getElementById(id)) {return;}
            js = d.createElement(s); js.id = id;
            js.src = "//connect.facebook.net/en_US/sdk.js";
            fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));
    </script>
    

    然后在你的&lt;a&gt;点击上调用这个方法:

    function ShareOnFacebook(){
    FB.ui(
    {
    method: 'feed',
    name: 'test Blog title',
    link: 'http://stackoverflow.com/',
    picture: 'https://pbs.twimg.com/profile_images/740344950097903616/mORHo2rZ.jpg',
    caption: 'I love stackoverflow',
    description: 'The stackoverflow forum will provide good solutions',
    message: ''
    });
    }
    

    这对你有用:)

    【讨论】:

      【解决方案2】:

      这个错误的发生似乎有多种原因,但他们并没有告诉你问题是什么。

      在我的例子中,我从标签字段中省略了 #,这显然是完全失败的原因。

      win.FB.ui({
        method: 'share',
        href,
        hashtag: '#wow', // NOT 'wow'
      })
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2017-11-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-12-24
        • 1970-01-01
        • 2012-07-29
        相关资源
        最近更新 更多