当我发布得分时,我正在使用sdk版本7.4我得到此错误
得分发布到fb {“错误”:{“message”:“(#100)Param得分必须是整数”,“类型”:“OAuthException”,“code”:100,“fbtrace_id”:“ElqTb0bxXz4”} }
有关守则
var scoreData = new Dictionary<string ,string> ();
scoreData ["score"] = UnityEngine.Random.Range (10f, 500f).ToString();
FB.API("/me/scores?fields=",HttpMethod.POST,delegate(IGraphResult result){
Debug.Log("score posted to the fb"+result.RawResult.ToString());
},scoreData);
任何建议或答案表示赞赏
var scoreData = new Dictionary<string ,int> ();
scoreData ["score"] = UnityEngine.Random.Range (10, 500);
FB.API("/me/scores?fields=",HttpMethod.POST,delegate(IGraphResult result){
Debug.Log("score posted to the fb"+result.RawResult.ToString());
},scoreData);
我有同样的错误,今天我修好了。
问题是我没有将整数类转换为字符串。问题可能是你的分数被保存为浮点数,当你转换它们ToString时它们转换为2.00,因此,不像Facebook请求那样是一个int。
我创建了一个变量:
int intScore = (int)myScore.
然后把它添加到我的词典中。
var dict = new Dictionary<string, string>();
dict["score"] = myScore.ToString;
这完美无瑕。