ウェブサイトとFacebookページがあるプロジェクトに取り組んでいます。これらは両方とも、SWFファイルがWebサイト/Facebookとの対話に使用するのと同じSWFファイルとJSコードを参照します。
共有のためにFB.ui()メソッドを呼び出すカスタムJavascriptアクションは、ダイアログ/ポップアップが表示されるほど機能しますが、Facebookではエラーが発生します(「エラーが発生しました。後でもう一度やり直してください。」)。すべてのブラウザでこのエラーが発生します。
stream.shareメソッドの使用は問題なく機能しますが、stream.publishはWebサイトに悲しみを与えてくれます。注目すべきは、まったく同じコードがFacebook内で機能することです。
両方のサイトで同じ方法でFBJSSDKをロードし(Facebookページは同じサーバーでホストされているiframeです)、ページのスクリプトも同じ順序でロードしています。
function connectFacebook(score) {
// No score, share link
if ( score == 0 ) {
FB.ui({
method: 'stream.share',
u: 'http://www.example.com/'
});
// Has score, publish to wall
} else {
FB.ui({
method: 'stream.publish',
message: 'I scored '+score+' at Game!',
attachment: {
name: 'Game',
caption: 'Game caption',
description: 'I scored '+score+'! Play and share to win the prize pack!',
href: 'http://www.example.com/'
},
action_links: [
{ text: 'Game', href: 'http://www.example.com/' }
],
user_message_prompt: 'Tell your friends about Game'
},
function(response) {
if ( response && response.post_id ) {
//alert( 'Post was published.' );
} else {
//alert( 'Post wasn\'t published.' );
}
});
}
}