簡體   English   中英

你如何使用FB.UI自動發布?

[英]How do you autopublish with FB.UI?

我有stream_publish權限,但它仍然會彈出一個對話框,似乎沒有任何方法可以傳遞autopublish bool(就像它在圖形api之前)。

編輯:還嘗試使用stream_publish offline_access。

有關如何使其工作的任何想法?


function streamPublish(imageUrl, imageHref, attachName, attachHref, attachCaption) {
 FB.ui(
   {
     method: 'stream.publish',
     message: '',
     attachment: {
       name: attachName,
       caption: attachCaption,
       description: (
         ''
       ),
       href: attachHref,
       media: [
         {
           type: 'image',
           href: imageHref,
           src: imageUrl
         }
        ]
     }
   },
   function(response) {
     if (response && response.post_id) {
       //alert('Post was published.');
     } else {
       //alert('Post was not published.');
     }
   }
 );
}

http://www.takwing.idv.hk/tech/fb_dev/jssdk/learning_jssdk_12.html

如果您擁有與FB.UI :)不同的權限,則以下內容將自動發布:


function publishPost(session) {
   var publish = {
     method: 'stream.publish',
     message: 'is learning how to develop Facebook apps.',
     picture : 'http://www.takwing.idv.hk/facebook/demoapp_jssdk/img/logo.gif',
     link : 'http://www.takwing.idv.hk/facebook/demoapp_jssdk/',
     name: 'This is my demo Facebook application (JS SDK)!',
     caption: 'Caption of the Post',
     description: 'It is fun to write Facebook App!',
     actions : { name : 'Start Learning', link : 'http://www.takwing.idv.hk/tech/fb_dev/index.php'}
   };

   FB.api('/me/feed', 'POST', publish, function(response) {  
       document.getElementById('confirmMsg').innerHTML = 
              'A post had just been published into the stream on your wall.';
   });
};  

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM