C# 使用HttpMethod.POST unity3D发布到Facebook墙
我正在使用unity并试图在我的墙上张贴。。。我导入了Facebook sdk,并在他们的文档中使用了这些代码C# 使用HttpMethod.POST unity3D发布到Facebook墙,c#,facebook,facebook-graph-api,unity3d,C#,Facebook,Facebook Graph Api,Unity3d,我正在使用unity并试图在我的墙上张贴。。。我导入了Facebook sdk,并在他们的文档中使用了这些代码 int score = 10000; var scoreData = new Dictionary<string, string>() {{"score", score.ToString()}}; FB.API ("/me/scores", HttpMethod.POST, LogCallback, scoreData); int分数=10000; var评
int score = 10000;
var scoreData =
new Dictionary<string, string>() {{"score", score.ToString()}};
FB.API ("/me/scores", HttpMethod.POST, LogCallback, scoreData);
int分数=10000;
var评分数据=
新字典(){{“score”,score.ToString()};
FB.API(“/me/scores”、HttpMethod.POST、LogCallback、scoresdata);
我已经允许发布设置(当我登录时)仍然没有发生任何事情。。
这就是我的代码
void Awake(){
FB.Init (SetInit, OnHideUnity);
}
private void SetInit(){
Debug.Log("IN");
}
private void OnHideUnity(bool isGameShown){
if (!isGameShown) {
Time.timeScale=0;
}
else {
Time.timeScale = 1;
}
}
void FBlogin()
{if (!FB.IsLoggedIn) {
FB.Login ("email,publish_actions", AuthCallback);
}
else { if (FB.IsLoggedIn) {
// Screen.orientation = ScreenOrientation.LandscapeRight;
Dictionary<string,string> score1=new Dictionary<string, string>();
score1.Add("Score","100");
FB.API ("/me/scores",Facebook.HttpMethod.POST, AuthCallback, score1);
Debug.Log("Okay");
}
}
}
void AuthCallback(FBResult result){
if (FB.IsLoggedIn) {
// Screen.orientation = ScreenOrientation.LandscapeRight;
int score = 10000;
Dictionary<string,string> scoreData =
new Dictionary<string, string>() {{"score", score.ToString()}};
FB.API ("me/scores", HttpMethod.POST, LogCallback, scoreData);
Dictionary<string,string> scoreData1 =
new Dictionary<string, string>() {{"score", "0"}};
}
else {
Debug.Log("FB LOGIN ERROR");
}
}
void Awake(){
FB.Init(SetInit,OnHideUnity);
}
私有void SetInit(){
Debug.Log(“登录”);
}
私密的虚空隐藏(如图所示){
如果(!isgame显示){
时间。时间刻度=0;
}
否则{
Time.timeScale=1;
}
}
void FBlogin()
{if(!FB.IsLoggedIn){
FB.登录(“电子邮件,发布操作”,AuthCallback);
}
else{if(FB.IsLoggedIn){
//Screen.orientation=ScreenOrientation.LandscapeRight;
字典分数1=新字典();
分数1.添加(“分数”、“100”);
FB.API(“/me/scores”,Facebook.HttpMethod.POST,AuthCallback,scores1);
Debug.Log(“好”);
}
}
}
void AuthCallback(FBResult结果){
如果(FB.IsLoggedIn){
//Screen.orientation=ScreenOrientation.LandscapeRight;
积分=10000;
字典分数数据=
新字典(){{“score”,score.ToString()};
FB.API(“me/scores”、HttpMethod.POST、LogCallback、scoresdata);
字典scoreData1=
新字典(){{“分数”,“0”};
}
否则{
Log(“FB登录错误”);
}
}
如果你想在Facebook上发帖,我发现我做错了什么
FB.API ("/me/feed", HttpMethod.POST, LogCallback, new Dictionary<string, string>() {{"access_token", FB.AccessToken},{"message","Test"}});
FB.API(“/me/feed”、HttpMethod.POST、LogCallback、newdictionary(){{“访问令牌”、FB.AccessToken}、{“消息”、“测试”});
而不是“测试”写你的帖子。。这在没有fb对话框的情况下自动发生(当然,您需要代表我启用post…)