2013-07-20 32 views
0

我使用Javascript,我的應用程序發佈使用FB.ui和FB.api Facebook最近到,我收到一個郵件,內容如下:fb.api或fb.ui如何上傳照片

它看起來像你的應用程序,(...)可能正在發佈帶有預先填充的 字幕的照片。如果是這種情況,您將需要在接下來的幾天內刪除任何默認照片 字幕以避免限制。

提醒一下,根據Facebook平臺政策 ,這是不允許的,因爲我們希望應用發佈的故事代表用戶的 語音。你可以閱讀更多有關此政策: https://developers.facebook.com/policy/#integration

我使用該功能的波紋管,而現在,經過了這麼多的測試做,我實在無法理解其中的功能之一是問題。 我懷疑功能upload_foto可能是問題,但我不確定,如果我不能使用javascript FB.api上傳照片,那我該怎麼做? 任何想法如何解決這個問題?

function postToWall(to_user_id, title1, url_to_picture, link_to_open) { 
     var control = document.getElementById("my_silverlight"); 
     //this will publish a story to the specified user or page (post owner is the user not the page) 
     FB.ui({ method: 'feed', 
      name: title1, 
      display: 'iframe', 
      link: link_to_open, 
      description: 'Some description', 
      caption: 'Some caption', 
      picture: url_to_picture, 
      type: 'photo', 
      to: to_user_id 
     }, function (response) { 
      if (response && response.post_id) { 
       control.content.PageName.update_post("success"); 
      } else { 
       control.content.PageName.update_post("error"); 
      } 
     }); 
    } 

function postToPage(to_user_id, title1, url_to_picture, link_to_open) { 
    var control = document.getElementById("my_silverlight"); 
    //this will publish a story to page if the user is the page's administrator (post owner will be the page itself) 
    FB.ui({ 
     method: 'feed', 
     name: title1, 
     display: 'iframe', 
     link: link_to_open, 
     description: 'Some description', 
     caption: 'Some caption', 
     picture: url_to_picture, 
     type: 'photo', 
     to: to_user_id, 
     from: to_user_id 
    }, function (response) { 
     if (response && !response.error) { 
      control.content.PageName.update_post("success"); 
     } else { 
      control.content.PageName.update_post("error"); 
     } 
    }); 
} 

function postToGroup_Event(to_profile_id, title1, mes, url_to_picture, link_to_open) { 
    var control = document.getElementById("my_silverlight"); 
    //this will publish a story to a group or an event as the curent user 
    FB.api("/" + to_profile_id + "/feed", 'post', { name: title1, link: link_to_open, description: 'Some description', caption: 'Some caption', picture: url_to_picture, message: mes }, function (response) { 
     if (response && !response.error) { 
      control.content.PageName.update_post("success"); 
     } else { 
      control.content.PageName.update_post("error"); 
     } 
    }); 
} 

function upload_foto(from, to_profile_id, url_to_foto, mess, own_wall) { 
    var control = document.getElementById("my_silverlight"); 
    //this will publish a foto with a message to a profile 
    FB.api(to_profile_id + '?fields=access_token', function (response) { 
     if (response && !response.error) { 
      FB.api(to_profile_id + '/photos', 'post', { from: from, url: url_to_foto, message: mess, access_token: response.access_token }, function (response) { 
       if (response && !response.error) { 
        control.content.PageName.update_post("success", response.post_id); 
       } else { 
        control.content.PageName.update_post("error", ""); 
       } 
      }); 
     } else { 
      control.content.PageName.update_post("error", ""); 
     } 
    }, { scope: '' }); 
} 

回答

1

函數「upload_foto」是問題。

根據Facebook政策,發送預填字幕(消息)違反了Facebook平臺政策第IV.2節。此政策禁止應用程序爲代表用戶發佈的任何照片預先填寫標題,除非用戶在工作流程的早期創建了內容。

「消息」不能由應用程序設置。這意味着您需要讓用戶編寫消息或不包含任何消息。