【发布时间】:2012-06-29 10:26:36
【问题描述】:
我正在使用 Facebook JS SDK 让我网站的用户从我的网站发送 FB 消息。我会定期看到以下错误:
API 错误代码:100
API 错误说明:参数无效
错误消息:查看者无法向指定的收件人发送消息。
我很困惑,因为它不会始终如一地发生。更像是每 8 次尝试一次,没有明显的模式。有什么想法吗?
这是我的代码。首先...
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '##########', // App ID
channelUrl : '//www.xxxxxxxxxx.com/channel.php', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
// Additional initialization code here
};
// Load the SDK Asynchronously
(function(d){
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.js";
ref.parentNode.insertBefore(js, ref);
}(document));
</script>
那么,这里是发送消息的链接:
<a href='#' onClick="
FB.ui({
method: 'send',
name: 'Bla bla bla',
link: 'http://www.xxxxxxxxxxx.com',
to: ###########,
//redirect_uri: 'http://www.xxxxxxxxxxx.com/fb/'
});
">Send a message</a>
【问题讨论】:
标签: facebook facebook-graph-api facebook-javascript-sdk