为什么不't我的Facebook应用程序发送邀请请求

Why doesn't my Facebook app send Invite requests?

本文关键字:请求 应用程序 Facebook 我的 为什么不      更新时间:2023-09-26

我已经做了几天了,找不到缺少的东西。有人有什么建议吗?

它似乎缺少了什么,但我不知道它会是什么。
我没有收到任何错误。共享按钮可以工作(共享到你自己的墙上),但邀请似乎根本没有任何作用。

我把我的appid换成了X。

<html>
<head>
    <title>App Name</title>
</head>
<body>
    <div id="fb-root"></div>
    <script>
        var publish = {
            method: 'stream.publish',
            display: 'popup', // force popup mode
            attachment: {
                name: 'Connect',
                caption: 'The Facebook Connect JavaScript SDK',
                description: (
                    'A small JavaScript library that allows you to harness ' +
                    'the power of Facebook, bringing the user''s identity, ' +
                     'social graph and distribution power to your site.'
                ),
                href: 'http://app-address.com/'
            }
        };
        function publish1() {
            FB.ui(publish);//, Log.info.bind('stream.publish callback'));
        }
    </script>
    <button class="btn" id="send-to-many">Send to Many</button>
    <button onclick="publish1()">Click</button>
</body>
<script>
    window.fbAsyncInit = function() {
        console.log('Initing facebook...');
        FB.init({
            appId: 'xxxxxxxxxxxxxxx', 
            status: true, 
            frictionlessRequests: true,
            cookie: true,
            xfbml: true
        });
        console.log('... done');
    };
    (function() {
        var e = document.createElement('script'); e.async = true;
        e.src = document.location.protocol +
          '//connect.facebook.net/en_US/all.js';
        document.getElementById('fb-root').appendChild(e);
    }());
    document.getElementById('send-to-many').onclick = function() {
        FB.ui({
            method: 'apprequests',
            message: 'This is a test of the App-Name invite.'
            }, requestCallback);
            function requestCallback(response)
{
if(response && response.request_ids) {
     // Here, requests have been sent, facebook gives you the ids of all requests
     //console.log(response);
     location.href='home';
} else {
     // No requests sent, you can do what you want (like...nothing, and stay on the page).
}
}
}
</script>
</html>

您的代码看起来不错。你的facebook应用程序设置中一定有错误。对于邀请功能,您必须提供"画布URL"&安全画布URL"在您的facebook应用程序设置中。你也可以试试下面的代码。这是一个实现起来非常简单的代码。

<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
appId:'APP_ID',
cookie:true,
status:true,
xfbml:true
});
function FacebookInviteFriends()
{
FB.ui({
method: 'apprequests',
message: 'Your Message diaolog'
});
}
</script>

//HTML Code
<div id="fb-root"></div>
<a href='#' onclick="FacebookInviteFriends();"> 
Facebook Invite Friends Link
</a>

在这里,您必须再编写一个javascript代码来破坏iframe。这样链接就不会在脸书内部打开。你还必须在你的主页或网站的任何其他页面上写下同样的js代码,你希望你的应用程序重定向。

<script type='text/javascript'>
if (top.location!= self.location)
{
top.location = self.location
}
</script>

如有任何疑问,请随时在这里写信。

我遇到了类似的问题,发现您必须单击DONE按钮。这是一个表单,DONE按钮提交表单。