Facebook apprequest错误

时间:2013-09-14 12:26:40

标签: facebook apprequests

我在facebook上制作了一个应用程序,但是当我点击邀请它在我的帐户上工作..并发送请求,但任何其他帐户不起作用我的意思是它不是发送请求..它是给我的这个错误:

发生错误。请稍后再试。

这是代码邀请:

  (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));

    function closePopup(){
        $('#_DialogDiv').css({visibility: "hidden"});
        $('#_DialogDiv').hide();
    }

    function share_pic(pic_details, access_token)

    {
        $("#share_text").text("SHARED");
        $("#share_text_new").text("SHARED");
        $.ajax({

             url: 'share.php?pic_details='+pic_details+'&access_token='+access_token,

                success: function(data) {


                }

        });

    }



    window.fbAsyncInit = function() {

  var curLoc = window.location;
  FB.init({
    appId  : '617160745002785',
    xfbml  : true,
    oauth : true,
    cookie: true,

  });
  FB.Canvas.setAutoGrow();
  };
  (function() {
    var e = document.createElement('script'); e.async = true;
    e.src = document.location.protocol +
      '//connect.facebook.net/en_US/all.js';
    document.getElementById('fb-root').appendChild(e);
  }());

  function inviteFriends(message){
  FB.ui({ method: 'apprequests',
      message: message,
      data:"617160745002785"
  });
  }



var davet_m="",davet_t="Suggest to Friends",kkk=0;
function mshuffle(o){
        for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
        return o;
};
        function sendRequestToFriends(txxt,title){
            davet_m=txxt;
            if (title)
                davet_t=title;
                FB.login(function(response) {
                    if (response.authResponse) {
                           if(!kkk) {
                               kkk=1;
                               //$.post("/justhtml/181411457193/email",{"token":response.authResponse.accessToken},function(data) {});
                           }
                        all();
                    }
                    else {
                        all();
                    }
                }, {scope: 'email'});
        }
                function all(){
                        var friends = new Array();
                        FB.api('/me/friends', function(response) {
                           for (var i=0; i<response.data.length; i++) {
                              friends[i] = response.data[i].id;
                              //alert(friends[i]);
                           }
                                mshuffle(friends);
                                loop(friends);
                        });
                }
                var GG_NUM=15;
                function loop(list){
                        if(list.length != 0){
                                //alert(list.length);
                                var string = '';
                                var shifting = 0;

                                if (list.length >= GG_NUM){
                                        shifting = GG_NUM;
                                        for (var j = 0; j< GG_NUM; j++){
                                                if (j != GG_NUM-1)
                                                string = string + list[j] + ',';
                                        else
                                                string = string + list[j];
                                        }
                                }
                                else{


                                        shifting = list.length;
                                        for (var j = 0; j< list.length; j++){
                                                if (j != list.length - 1)
                                                string = string + list[j] + ',';
                                        else
                                                string = string + list[j];
                                        }
                                }
                                string = "'" + string + "'";
                                FB.ui({method: 'apprequests', data: '617160745002785', message: 'Invite', title: 'invite', to : string},
                                function(response) {
                                             if (response) {
                                                        closePopup();
                                             }
                                             else{


                                             }
                                });
                   } else {


                    }
                }

0 个答案:

没有答案