2011-08-06 11 views
0

私はfacebookで作成されたアプリを介して私のウェブサイトから壁にメッセージを投稿するためにjs sdkを使用しています。私は単一の壁に投稿するとき、上のコードはうまくいきます。問題は複数の壁に同じメッセージを同時にポップアップやダイアログを表示せずに投稿したいという問題です。私はそれがループで行われなければならないことを知っているが、それを働かせることはできません。facebook multiple壁に公開する

私のコードは、ヘルプのいずれかの種類がapreciatedされます

var publish = 
      { 
       method: 'stream.publish', 
       // display: 'popup', 


       attachment: 
       { 
        name: 'name' , 
        caption: 'www.caption.com' , 
        description: ('description'), 
    href: 'url', 
        media: [ 
        { 
        type: 'image', 
      href: 'url', 
        src: 'url' 
        } 
       ]     
       } 
      }; 

     publish.target_id =id1; 
     FB.ui(publish); 
     publish.target_id = id2; 
     FB.ui(publish); 

      return false; 

     } 

です。

感謝のために

答えて

1

http://developers.facebook.com/policy/

5. You must not provide users with the option to publish more than one Stream story at a time. 

あなたが複数の壁に同じ時間に同じメッセージを投稿する避ける必要があります。

編集

しかし、あなたが実際にそれを行うにwan't場合: あなたはFb.uiを(使用しないでください)、それはFacebookのダイアログのために使用されています。 USER_IDと「私」

var body = 'Reading JS SDK documentation'; 
FB.api('/me/feed', 'post', { message: body }, function(response) { 
    if (!response || response.error) { 
    alert('Error occured'); 
    } else { 
    alert('Post ID: ' + response.id); 
    } 
}); 

ので、あなただけのループに自分のユーザーIDを持っている、と交換してください:

は、その代わりに、使用することができます。

+1

それはあなたがこれをやってFacebookのアプリチームのスポットならば、彼らが最初にアプリをテイクダウンし、後で質問をすることは注目に値しますそれが本当に価値があるかどうかを検討してください。 – shanethehat

0

最終的に私はそれがこのコードを使用して作業しました:応答のための

function doitonfacebook(){ 

var receivers = document.getElementById("selected-friends").innerHTML; 

var temp = new Array(); 

temp = receivers.split(','); 

var count =temp.length; 

for (var i = 0; i < count; i++) { 

var publish = { 

    method: 'stream.publish', 
    message: 'test', 
    picture : 'http://www.takwing.idv.hk/facebook/demoapp_jssdk/img/logo.gif', 
    link : 'http://www.test.com', 
    name: 'test', 
    caption: 'Caption of the Post', 
    description: 'testttttt', 
    actions : { name : 'testing', link : 'http://www.takwing.idv.hk/tech/fb_dev/index.php'} 
    }; 

FB.api('/'+temp[i]+'/feed', 'post',publish, function(response) { 
    if (!response || response.error) { 
    alert('Error occured'); 
    } else { 
    alert('success publishing: '); 
    } 
}); 


     }} 

おかげ

関連する問題