-2

そのように、事前に指定された宛先でダイアログをポップアップしようとしています:

FB.init({
  appId      : 'MYAPPID',
  status     : true,
  cookie     : true, 
  xfbml      : true,  
  frictionlessRequests: true
}); 

function sendRequestToRecipients() 
{
    FB.ui({method: 'apprequests',
      message: 'You have just received a PP request.',
      to: '100000526845569'
    }, requestCallback);
}

sendRequestToRecipineds();

ポップアップが開くと、次のエラーが表示されます。An error occurred. Please try later

ポップアップのリクエスト URL を見ると、次のように表示されます。

https://www.facebook.com/dialog/apprequests?message=You%20have%20just%20received%20a%20PP%20request.&to=100000526845569&api_key=&app_id=&locale=en_US&sdk=joey&display=popup&frictionless=false&next=http%3A% 2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D18%23cb%3Df23f09878cdaf1e%26origin%3Dhttp%253A%252F%252Fmyhost.com%252Ff1868d80900b7a%26domain%3Dmyhost.com%26%relation%26%Dopener 3Df27cb35acbd146c%26result%3D%2522xxRESULTTOKENxx%2522

一部の情報が送信されていないと思います: api_key, app_id

どうして?何か案は?

Facebookでのログインは完全に機能します。マルチフレンドセレクターも。


<script>
window.fbAsyncInit = function() {
 // init the FB JS SDK
FB.init({
  appId      : 'MYAPPID', // App ID from the App Dashboard
  channelUrl : '//mydomain.com/channel.html', // 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?
  frictionlessRequests: true
});


};

 // Load the SDK's source Asynchronously

 (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*/ false));

function sendRequestToRecipients() {

    FB.ui({method: 'apprequests',
      message: 'You have just received a PP request.',
      to: '100000143396036'
    }, requestCallback);
  }

  function sendRequestViaMultiFriendSelector() {
    FB.ui({method: 'apprequests',
      message: 'My Great Request'
    }, requestCallback);
  }

  function requestCallback(response) {
    // Handle callback here
  }

 </script>

それがここでの作り方です

4

2 に答える 2

1

FB.init()次のように呼び出す前に(まだ行っていない場合)、javascript SDK を非同期でロードしてみてください。

<script>

  window.fbAsyncInit = function() 
  {
    FB.init({
      appId      : APP_ID,
      status     : true, 
      cookie     : true, 
      xfbml      : true,  
      frictionlessRequests: true
    });
    //Additional 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>
于 2013-01-04T10:53:12.770 に答える
1

修繕。

奇妙ですが、ASYNC SDK の存在がすべてを台無しにしました。

ありがとうございました

于 2013-01-04T11:56:40.277 に答える