0
votes

I am using sdk version 7.4 when i post the score i get this error

score posted to the fb{"error":{"message":"(#100) Param score must be an integer","type":"OAuthException","code":100,"fbtrace_id":"ElqTb0bxXz4"}}

Concerned Code

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);

Any Suggestion or answer is appreciated

2

2 Answers

0
votes
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);
0
votes

I had this same error and I fixed it today.

The issue is I was not converting an integer class to string. The problem could be your scores are saved as float, and when you convert them ToString they convert as 2.00, thus, not being an int as Facebook requests.

I created a variable:

int intScore = (int)myScore.

And then just added it to my dict.

var dict = new Dictionary<string, string>();
dict["score"] = myScore.ToString;

That worked flawlessly.