我正在使用 PHP 开发 Android 游戏,但是当我尝试将乐谱发布到我的 Facebook 墙上时,描述与另一个应用程序合并。
取自此 App 的描述 Daily Tools我的实际游戏是Just Double It
下面是图片,标志和描述是错误的
描述:我的游戏描述+我的应用描述。
描述是自动检测到的,不是我写的。
这是我发布到 Facebook 的代码 fragment
var APP_ID="*****************";
window.fbAsyncInit = initFacebook;
function initFacebook()
{
FB.init({
appId : APP_ID,
status : true, // check login status
cookie : false, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
FB.getLoginStatus(onFacebookLoginStatus);
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
//the login function
function facebookLogin()
{
var loginUrl="http://www.facebook.com/dialog/oauth/?"+
"scope=publish_stream&"+
"client_id="+APP_ID+"&"+
"redirect_uri="+document.location.href+"&"+
"response_type=token";
window.location=loginUrl;
}
function postToWallUsingFBApi()
{
var score=atob(document.getElementById("txtscore").value);
var data=
{
caption: "scores "+score,
message: "I challenge you to beat my score "+score + " in Just Double It! on your Android Phone !!!",
picture: "http://www.learning-delight.com/ldapps/Game/main.png",
link: 'https://play.google.com/store/apps/details?id=com.appslight.justdoubleit',
}
FB.api('/me/feed', 'post', data, onPostToWallCompleted);
}
//the return function after posting to wall
function onPostToWallCompleted(response)
{
(response)
{
if (response.error)
{
document.getElementById("txtEcho").innerHTML=response.error.message;
}
else
{
if (response.id){
window.close();
t = setTimeout("self.close()",500);
}
else if (response.post_id)
document.getElementById("txtEcho").innerHTML="Posted as post_id responce "+response.post_id;
else
document.getElementById("txtEcho").innerHTML="Unknown Error";
}
}
}
最佳答案
@DrewT 的回答涵盖了问题和一些解决方法。另一种方法是完全控制您发布的内容,不要让 Facebook 抓取它。如果您查看 post params你可以发送到 facebook,你会注意到还有一个 description
参数。
var data=
{
caption: "scores "+score,
description: "I HAVE THE POWER!!",
message: "I challenge you to beat my score "+score + " in Just Double It! on your Android Phone !!!",
picture: "http://www.learning-delight.com/ldapps/Game/main.png",
link: 'https://play.google.com/store/apps/details?id=com.appslight.justdoubleit',
}
关于php - FaceBook 集成麻烦的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23408409/