2013-03-05 95 views
1

我每次尝试通过Facebook JS Sdk调用发送对话时都会收到此错误。Facebook api返回错误代码100

API错误代码:100 API错误描述:无效参数 错误消息:'link'无效。

这是我的代码。

初始化

 window.fbAsyncInit = function() { 
      // init the FB JS SDK 
      FB.init({ 
       appId  : '${sp.apiKey}', // App ID from the App Dashboard 
       //  channelUrl : 'http://localhost:8084/facebook/callback', // Channel File for x-domain communication 
       status  : true, // check the login status upon init? 
       cookie  : true, // set sessions cookies to allow your server to access the session? 
       xfbml  : true // parse XFBML tags on this page? 
      }); 

      // Additional initialization code such as adding Event Listeners goes here 

     }; 
     (function(d, debug){ 
      var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; 
      if (d.getElementById(id)) {return;} 
      js = d.createElement('script'); js.id = id; js.async = true; 
      js.src = "//connect.facebook.net/en_US/all" + (debug ? "/debug" : "") + ".js"; 
      ref.parentNode.insertBefore(js, ref); 
     }(document, /*debug*/ true)); 

发送对话框功能

function sendFacebookMessage(id, jobid){ 

      FB.ui({ 
       method: 'send', 
       name: 'Some text here.', 
       to:id, 
       link: 'www.some-url.com' 

       //tomcat is running on port 8084 
      }); 
     } 

我已经尝试过的HTTP:// ...没有它... ...每一个结果是同时

。 'link'无效。

任何想法?

回答

1

documentation不是特定的,但您可能无法在此上下文中指定localhost链接。该URL仅适用于本地计算机上的您。它不适合作为公共网站上的链接。

+0

你是对的,我的例子很糟糕,所以我编辑了它。我在我们的测试服务器上遇到了同样的问题。 – brakebg 2013-03-05 13:45:00