本文介绍了Facebook API错误代码:100错误消息:查看器无法消息指定的收件人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Facebook JS SDK让我的网站的用户从我的网站发送FB消息。我定期看到以下错误:



API错误代码:100

API错误说明:参数无效

错误消息:查看器无法发送指定的收件人。



我感到困惑,因为它不会一直发生。每8次尝试更像是一次,没有明显的模式。任何想法?



这是我的代码。首先...

 < script> 
window.fbAsyncInit = function(){
FB.init({
appId:'#########',// App ID
channelUrl: '//www.xxxxxxxxxx.com/channel.php',//通道文件
状态:true,//检查登录状态
cookie:true,//启用Cookie以允许服务器访问session
xfbml:true // parse XFBML
});

//其他初始化代码在这里
};

//异步加载SDK
(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/'
});
>发送消息< / a>


解决方案

您不让用户选择收件人如果收件人有他的设置,以便他不接受来自每个人的消息,而您的用户不是这样的。他们的朋友 - 那就是我会希望发生的事情。


I'm using the Facebook JS SDK to let my site's users send FB messages from my site. I periodically see the following error:

API Error Code: 100
API Error Description: Invalid parameter
Error Message: Viewer cannot message specified recipients.

I'm confused because it doesn't happen consistently. It's more like once in every 8 attempts, with no apparent pattern. Any ideas?

Here's my code. First...

<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>

Then, here's the link to send the message:

<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>
解决方案

You’re not letting the user chose the recipient(s) themselves, but try to set them yourself.

If the recipient has his settings so that he doesn’t accept messages from "everyone", and your user is not a friend of theirs – then that’s exactly what I would expect to happen.

这篇关于Facebook API错误代码:100错误消息:查看器无法消息指定的收件人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-27 04:04
查看更多