1

我開發了一個Facebook應用程序/獨立網站,使用自定義對象和操作來支持利茲大學開放日。這是使用JavaScript SDK構建的。Facebook應用程序內置JavaScript SDK不張貼到時間線

這裏是URL - https://fbapps.leeds.ac.uk/opendays/recap.html

的代碼工作正常,併發布到的Open Graph,但只有職位,以該用戶的個人資料並沒有出現在時間軸上。

Facebook已批准我的顯式共享請求,並且已在應用設置中啓用此功能,但它仍然不會像我期望的那樣發佈到用戶時間軸上。

雖然該帖子顯示在活動日誌中。

我已將explict sharing參數添加到代碼中,更改了默認隱私設置並在data_scope中啓用了publish_actions。

有沒有人有任何想法請錯過什麼,因爲看不出來的問題?

任何建議感激地收到。非常感謝任何人都可以提供這方面的幫助。

下面的代碼:

<script type="text/javascript"> 
    // You probably don't want to use globals, but this is just example code 
    var fbAppId = '1471972309703879'; 
    var objectToLike = 'https://fbapps.leeds.ac.uk/recap.html'; 

    /* 
    * This is boilerplate code that is used to initialize 
    * the Facebook JS SDK. You would normally set your 
    * App ID in this code. 
    */ 

    // Additional JS functions here 
    window.fbAsyncInit = function() { 
    FB.init({ 
     appId  : 1471972309703879, // App ID 
     status  : true, // check login status 
     cookie  : true, // enable cookies to allow the 
          // server to access the session 
     xfbml  : true,  // parse page for xfbml or html5 
          // social plugins like login button below 
     version : 'v2.0', // Specify an API version 
    }); 

    // Put additional init code here 
    }; 

    // Load the SDK Asynchronously 
    (function(d, s, id){ 
    var js, fjs = d.getElementsByTagName(s)[0]; 
    if (d.getElementById(id)) {return;} 
    js = d.createElement(s); js.id = id; 
    js.src = "//connect.facebook.net/en_US/sdk.js"; 
    fjs.parentNode.insertBefore(js, fjs); 
    }(document, 'script', 'facebook-jssdk')); 

    /* 
    * This function makes a call to the og.likes API. The 
    * object argument is the object you like. Other types 
    * of APIs may take other arguments. (i.e. the book.reads 
    * API takes a book= argument.) 
    * 
    * Because it's a sample, it also sets the privacy 
    * parameter so that it will create a story that only you 
    * can see. Remove the privacy parameter and the story 
    * will be visible to whatever the default privacy was when 
    * you added the app. 
    * 
    * Also note that you can view any story with the id, as 
    * demonstrated with the code below. 
    * 
    * APIs used in postLike(): 
    * Call the Graph API from JS: 
    * https://developers.facebook.com/docs/reference/javascript/FB.api 
    * The Open Graph og.likes API: 
    * https://developers.facebook.com/docs/reference/opengraph/action-type/og.likes 
    * Privacy argument: 
    * https://developers.facebook.com/docs/reference/api/privacy-parameter 
    */ 

    function postLike() { 
    FB.api(
     'me/leedsopendaypics:enjoy', 
     'post', 
     { recap: "https://fbapps.leeds.ac.uk/opendays/recap.html", 
     fb:explicitly_shared = "true", 
     privacy: {'value': 'EVERYONE'} }, 
     function(response) { 
     if (!response) { 
      alert('Error occurred.'); 
     } else if (response.error) { 
      document.getElementById('result').innerHTML = 
      '<h3>Please log in to Facebook above so you can share this page</h3>'; 
     } else { 
      document.getElementById('result').innerHTML = 
      '<a href=\"https://www.facebook.com/me/activity/' + 
      response.id + '\" target="_parent">' + 
      '<h3>Thanks. That has now been shared.</h3></a>'; 
     } 
     } 
    ); 
    } 
</script> 

<!-- 
    Login Button 

    https://developers.facebook.com/docs/reference/plugins/login 

    This example needs the 'publish_actions' permission in 
    order to publish an action. The scope parameter below 
    is what prompts the user for that permission. 
--> 

<div 
    class="fb-login-button" 
    data-show-faces="true" 
    data-width="200" 
    data-max-rows="1" 
    data-scope="publish_actions" 
    return_scopes="true"> 
</div> 

<div> 
<input 
    type="button" 
    class="button" 
    value="Share this recap page on your Facebook Timeline" 
    onclick="postLike();"> 
</div> 

<div id="result"></div> 

回答

2

嗯,這將打開圖的好事:d

的Open Graph的故事並不會發佈爲狀態,那就是用戶已經進行的活動使用你的應用。因此,這些故事作爲應用程序活動捆綁在一起,而不是在時間軸上發佈狀態,並且不必要地淹沒時間表。

所以,在你的時間表檢查爲最近活動部分(向下滾動了一下,你會發現) -

enter image description here

不過不用擔心這個故事是在一個共享在你和你的朋友的(無論你設置的隱私設置)上的適當的大塊。要了解這個故事在牆上如何顯示,你可以檢查牆壁本身,但如果你找不到它(有n個牆貼,可能很難找到) -

  • 點擊的時候,黃標在上面的截圖,或
  • 轉到活動日誌,然後點擊時間

    enter image description here


而這裏的職位將如何看待喜歡 -

enter image description here

+0

非常感謝薩赫勒。這真的很有幫助。通讀大量的文檔,你的解釋最有意義。 :-) – user3801462

相關問題