2013-02-19 43 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