0

過去数日間、グラフAPI(Javascript)を使用してユーザーの友達の壁に公開しようとしました:

FB.api('/me/feed', 'post', params, function(response) 動作します!.

ただし、これを使用しようとすると:

FB.api('/' + targetID +'/feed', 'post', params, function (response) it does not work

これは私のコードです

window.fbAsyncInit = function () 
  {
   FB.init({
   appId:'1**************3', 
   status:true, 
   cookie:true, 
   xfbml:true 
  });
FB.getLoginStatus(function (response) 
 {
  if (response.status === 'connected') 
   {
       var uid = response.authResponse.userID;
       var at = response.authResponse.accessToken;
       var params = {};
       params['message'] = 'message';
       params['name'] = 'name';
       params['description'] = 'description';
       params['link'] = 'link';
       params['picture'] = 'url picture';
       params['caption'] = 'caption';

       FB.api('/me/feed', 'post', params, function(response) 
       {
        if (!response || response.error) 
         {
          alert('Error occured');
         } 
        else 
         {
          alert('Published to stream!');
         }
       });  

     var targetID='1*******2';
     FB.api('/' + targetID +'/feed',  'post', params, function(response) 
      {
       if (!response || response.error) 
       {
         alert('not published! no yay');
       } 
       else 
       {
        alert('Published yay!');
       }
      }); 
    } else if (response.status === 'not_authorized') {
    // xxxxxxx
   } else {
    // the user isn't logged in to Facebook.
  }
 });
};

(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 = "https://connect.facebook.net/en_US/all" + (debug ? "/debug" : "") + ".js";
   ref.parentNode.insertBefore(js, ref);
 }(document, /*debug*/ true));

誰でも私を助けてくれますか?

本当にありがとう!

4

0 に答える 0