2013-02-19 44 views
3

我試圖在Facebook上分享但是無法分享任何內容。 ,我已經使用的代碼是: -如何訪問BB10中的FB共享?

在Javascript中

FB.init({ 
     appId: 'some id', 
     cookie: true, 
      status:true, 
      xfbml:true, 
      oauth:true 
     }); 


     function postToFeed() { 

     // calling the API ... 
     var obj = { 
      method: 'feed', 
      link: 'http://www.example.com', 
      picture: imageToShare, 
      name: 'name', 
      caption: 'This Link is Shared through the some application.', 
      description: '' 

     }; 

     function callback(response) { 
      //document.getElementById('msg').innerHTML = "Post ID: " + response['post_id']; 
     } 

     FB.ui(obj, callback); 
     } 

在配置文件中

<access uri="http://connect.facebook.net" /> 

在此先感謝。

回答

3

如果你想要做的就是從你的應用程序分享到Facebook的一些東西,你可以使用卡很容易地做到這一點。

我寫了一篇博客上這樣的位置:http://devblog.blackberry.com/2013/02/twitter-and-facebook-cards/

基本上,你正在使用的黑莓調用框架調用卡,以及一些數據傳遞到該卡。

function invokeFacebook() { 
    blackberry.invoke.invoke({ 
     target: "Facebook", 
     action: "bb.action.SHARE", 
     type: "text/plain", 
     data: "I’m eating tacos with Alex." 
    }, onSuccess, onError); 
} 

如果你想分享圖片你只需換出與「數據」屬性:

uri: 'file://' + pathToFile, 

還有一個示例應用程序在我們的GitHub庫:https://github.com/ctetreault/BB10-WebWorks-Samples/tree/master/invoke/invoker

+0

嗨chadtatro, 我收到一個錯誤「調用錯誤:INVOKE_NO_TARGET_ERROR」你能幫我嗎? 謝謝 – Arpit 2013-02-28 09:21:11