2011-01-20 5 views
0

FB.uiを使用してクライアントのWebサイトからfacebookへの単純なストリームを公開しようとしていますが、このコードを保持している "streamPublish"メソッドを実行すると「エラーが発生しました。後でやり直してください。 "次のようにFB.ui/Publish Stream Issue

私のコードは次のとおりです。 -

<head> 
<title>A Dynamic Comment System</title> 
<meta http-equiv="content-type" 
    content="text/html;charset=utf-8" /> 
<meta http-equiv="Content-Style-Type" content="text/css" /> 

<!-- Javascript Librairys --> 
<script src="http://connect.facebook.net/en_US/all.js"></script> 
<script type="text/javascript" src="javascripts/commentsystem.js"></script> 

<!-- Style Sheets --> 
<style type="text/css" media="all"> 
    @import "css/commentstyles.css"; 
</style> 

    <script> 
      window.fbAsyncInit = function() { 
    FB.init({appId: "180166762023187", status: true, cookie: true, 
       xfbml: true}); 
      }; 

    (function() 
    { 
    var e = document.createElement("script"); e.async = true; 
    e.src = document.location.protocol + "//connect.facebook.net/en_US/all.js"; 
    document.getElementById("fb-root").appendChild(e); 
    }()); 

    function streamPublish() 
    {  
    FB.ui( 
     { method: 'stream.publish',display:'popup', message: 'getting educated about Facebook Connect', attachment: 
     {  
     name: 'Connect', caption: 'The Facebook Connect JavaScript SDK', description: ('A small JavaScript library that allows you to harness ' + 'the power of Facebook, bringing the user\'s identity, ' + 'social graph and distribution power to your site.'), 
     href: 'http://github.com/facebook/connect-js'  
     }, action_links: [{ text: 'Code', href: 'http://github.com/facebook/connect-js' }],  
     user_message_prompt: 'Share your thoughts about Connect' 
     }, 
     function(response) 
     {  
     if (response && response.post_id) 
     {  
     alert('Post was published.');  
     } 
     else 
     {  
     alert('Post was not published.');  
     } 
     }); 
    } 
    </script> 
</head> 

私はすべてのFBのAPIとそのなじみのないですので、私は完全に困惑しています - 任意のヘルプははるかに高く評価します! :)

答えて

0

これはFB.initがFB.initが終了する前に呼び出された場合に発生することがあります。私はこの問題も抱えており、FB.initを自分のonload関数に置くことは、問題の解決には役立ちますが、完全には解決しません。これがあなたに役立つことを願っています

1

私は同じ問題を抱えていました。私はFB.initをwindow.fbAsyncInitに入れましたが、ページをリフレッシュするときにエラーが表示されていました。私はそれがあなたのために働くだろうとしても、うまくいけば

FB.init({appId: "12345", status: true, cookie: true, 
      xfbml: true}); 
FB.ui(
    { 
method: 'feed', 
name: 'WIN A TRIP TO NYC!', 

をonclickイベントを呼び出したJavaScriptでFB.initを置くことによってそれを解決してきました:)