0

こんにちは、私は Facebook 開発に不慣れで、以下のコードを使用してフィードを投稿したいと考えていますが、メッセージも user_message_prompt もテキスト ボックスに表示されません。これを許可するには、アプリケーションで何かを設定する必要がありますか? 私が得るのはデフォルトのメッセージだけです。

以下の2つの方法を試しましたが、どちらもメッセージもuser_message_promptメッセージも表示しません。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
    <title></title>
</head>
<body>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>

        FB.init({ appId: "174009502722096", status: true, cookie: true, xfbml: true });

        function postToFeed() {

        var publish = {
        method: 'feed',
        message: 'Martin Okello presents share',
        caption: 'Visit MartinLayooinc',
        description: (
        'Martin Okello, aka the medallion presents his application'
        ),
        link: 'http://www.martinlayooinc.co.uk',
        picture: 'http://www.martinlayooinc.co.uk/topImages/bigMedallion.jpg',
        user_message_prompt: 'Share MartinLayooinc Software with friends!'
       };

       FB.ui(publish, 
       function(response)
       {
       alert('MartinLayooInc has been posted!!')
       });

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

       FB.ui(obj, callback);

       }

</script>
    <!--from here-->
    <div id="fb-root">
        <p>
            <a onclick='postToFeed(); return false;'><img src="topImages/facebook_button.png" style="height:20px; width:80px;" />
            </a>
        </p>
        <p id='msg'>
        </p>
    </div>
</body>
</html>
<script type="text/javascript">
    window.fbAsyncInit = function () {
        FB.init({ appId: '174009502722096', status: true, cookie: true, xfbml: true });

        /* All the events registered */
        FB.Event.subscribe('auth.login', function (response) {
            // do something with response
            login();
        });
        FB.Event.subscribe('auth.logout', function (response) {
            // do something with response
            logout();
        });

        FB.getLoginStatus(function (response) {
            if (response.session) {
                // logged in and connected user, someone you know
                login();
            }
        });
    };
    (function () {
        var e = document.createElement('script');
        e.type = 'text/javascript';
        e.src = document.location.protocol +
            '//connect.facebook.net/en_US/all.js';
        e.async = true;
        document.getElementById('fb-root').appendChild(e);
    } ());
</script>
4

2 に答える 2

4

どちらも非推奨だと思います。message パラメーターは無視されるようになり、ドキュメントに他のパラメーターが表示されませんでした。どうやら、Facebook はユーザーに、強制されたり促されたりするのではなく、テキスト フィールドに自分のメッセージを入力することを望んでいるようです。こちらのメイン情報ページをご覧ください。

https://developers.facebook.com/docs/reference/javascript/FB.ui/

詳細ページはこちら:

https://developers.facebook.com/docs/reference/dialogs/feed/

一番下までスクロールすると、サポートされているパラメーターが表示されます。うまくいけば、それはあなたにとってゲームチェンジャーではありません.

于 2012-06-13T13:53:38.350 に答える