我曾尝试在 Facebook 上分享,但无法分享任何内容。 我使用的代码是:-
在 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" />
提前致谢。
最佳答案
如果您只想将您的应用程序中的内容分享到 Facebook,您可以使用卡片轻松实现。
我在这里写了一篇关于此的博文:http://devblog.blackberry.com/2013/02/twitter-and-facebook-cards/
基本上,您使用 BlackBerry 调用框架来调用 Card,并将一些数据传递给该卡。
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
关于blackberry-webworks - 如何访问BB10中的FB分享?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14952142/