1

私はFacebookのAPIで本当に苦労しています。Aがアプリ、オブジェクト、アクションを作成しました。ストリームで公開するためにテストしたいと思います(公開公開は、Facebookによって承認される必要があることはわかっていますが、アプリの管理者として、テストすることができます)。しかし、それは気になりません。スクリプトは次のとおりです。

<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"
  xmlns:fb="https://www.facebook.com/2008/fbml"> 
<head prefix="og: http://ogp.me/ns# subhinajjar: 
              http://ogp.me/ns/apps/subhinajjar#">
<title>OG Tutorial App</title>
<meta property="fb:app_id" content="452488354765730" /> 
<meta property="og:type" content="subhinajjar:article" /> 
<meta property="og:title" content="3eesho" /> 
<meta property="og:image" content="https://3eesho.com/public/admin/logo.png" /> 
<meta property="og:description" content="3eesho reading club" /> 
<meta property="og:url" content="https://3eesho.com/">

<script type="text/javascript">
function postreads()
{
  FB.api(
    '/me/subhinajjar:read?article',
    'post',
    { article: 'https://3eesho.com/articles/2346/-' },
    function(response) {
       if (!response || response.error) {
          alert('Error occured');
       } else {
          alert('read was successful! Action ID: ' + response.id);
       }
    });
 }
</script>
</head>
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
  FB.init({
    appId      : '452488354765730', // App ID
    status     : true, // check login status
    cookie     : true, // enable cookies to allow the server to access the session
    xfbml      : true  // parse XFBML
  });
};

// Load the SDK Asynchronously
(function(d){
  var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
  js = d.createElement('script'); js.id = id; js.async = true;
  js.src = "//connect.facebook.net/en_US/all.js";
  d.getElementsByTagName('head')[0].appendChild(js);
}(document));
</script>

<h3>Stuffed Cookies</h3>
<p>
<img title="3eesho reading club" 
     src="https://3eesho.com/public/admin/logo.png" 
     width="550"/>
</p>

<br>
<form>
<input type="button" value="read" onclick="postreads()" />
</form>

<fb:activity actions="subhinajjar:read"></fb:activity>

</body>
</html>

しかし、私はいつもこのメッセージを持っています:エラー合意。そして、これは私を夢中にさせます。誰かが私にこのコードを変更できるかどうかを願っています。

4

1 に答える 1

0

API 呼び出しの URL を次のように変更してみてくださいFB.api: '/me/subhinajjar:read'(つまり、記事をデータとして投稿するため、記事を削除します)。

ブロック内でエラーを警告してresponse、アクションが facebook に投稿されたときに実際に何が起こるかを確認します。コードは次のようになります。

function postreads()
{
  FB.api(
    '/me/subhinajjar:read',
    'post',
    { article: 'https://3eesho.com/articles/2346/-' },
    function(response) {
       if (!response || response.error) {
          // show the error
          alert( response.error );
       } else {
          alert('read was successful! Action ID: ' + response.id);
       }
    });
 }

それでもうまくいかない場合は、組み込みの読み取りアクションを使用してみてください。

  FB.api(
    '/me/news.reads',
    'post',
    { article: 'https://3eesho.com/articles/2346/-' },
    function(response) {
       if (!response || response.error) {
          // show the error
          alert( response.error );
       } else {
          alert('read was successful! Action ID: ' + response.id);
       }
    });
 }
于 2012-05-30T10:54:21.347 に答える