我的Facebook应用程序突然停止发送消息,我没有改变任何事情。 这是我的代码:
<script type="text/javascript">
function logResponse(response) {
if (console && console.log) {
console.log('The response was', response);
}
}
$(function(){
// Set up so we handle click on the buttons
$('#postToWall').click(function() {
FB.ui(
{
method : 'feed',
link : '<?php echo "$link"; ?>',
name : 'name',
caption: ' ',
description: 'description',
actions: [{
'name':'Enter to win',
'link':'<?php echo "$link"; ?>'
}]
},
function (response) {
// If response is null the user canceled the dialog
if (response != null) {
logResponse(response);
}
}
);
});
$('#sendToFriends').click(function() {
FB.ui(
{
method : 'send',
name : 'name',
description: 'description',
link : $(this).attr('data-url')
},
function (response) {
// If response is null the user canceled the dialog
if (response != null) {
logResponse(response);
}
}
);
});
$('#sendRequest').click(function() {
FB.ui(
{
method : 'apprequests',
message : $(this).attr('data-message')
},
function (response) {
// If response is null the user canceled the dialog
if (response != null) {
logResponse(response);
}
}
);
});
});
</script>
您在上面和下面看到的代码是从一个heroku示例应用程序中获取的,我只是进行了一些修改,它正在发送消息,然后它突然停止工作
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
appId : '<?php echo AppInfo::appID(); ?>', // App ID
channelUrl : '//<?php echo $_SERVER["HTTP_HOST"]; ?>/app/channel.html', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
// Additional initialization code here
};
// Load the SDK Asynchronously
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<?php if ($user_id) { ?>
<div id="share-app" align="center"><!--share app-->
<br>
<a href="#" class="facebook-button" id="postToWall">
<span class="plus">Post to Wall</span>
</a>
<a href="#" class="facebook-button speech-bubble" id="sendToFriends" data-url="<?php echo "$link";?>">
<span class="speech-bubble">Send Message</span>
</a>
<a href="#" class="facebook-button apprequests" id="sendRequest" data-message="message">
<span class="apprequests">Send Invite Requests</span>
</a>
<br>
<?php } ?>
我正在比较两个代码,原始代码和修改代码,但我没有看到任何错误。
你知道为什么这不起作用吗?