3

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" />

前もって感謝します。

4

1 に答える 1

3

アプリから 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);
}

画像を共有したい場合は、'data' 属性を次のように置き換えます。

uri: 'file://' + pathToFile,

GitHub リポジトリにもサンプル アプリがあります: https://github.com/ctetreault/BB10-WebWorks-Samples/tree/master/invoke/invoker

于 2013-02-25T19:35:24.287 に答える