Facebook SDK - “FB.API” not saving or loading score values

Based on the code provided by the official Facebook Unity project, I cannot save nor load a score value. I receive no error or message whatsoever - A value of 0 is always returned when I attempt to retrieve the score.

I save the player’s score like this:

public void SaveScore(int _score)
{
    _fbScore = _score;

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

    FB.API("/me/scores", Facebook.HttpMethod.POST, delegate(FBResult r) { Util.Log("Result: " + r.Text); }, _query);

    //FB.API ("/me/scores", Facebook.HttpMethod.POST, ScoreSaveCallBack, scoreData);
    _hiScoreText.text = _fbScore.ToString();
}

I then try to retrieve the score with this method:

public void GetHighScore()
{
    if (_fbIsInited)
        FB.API ("/app/scores?fields=score,user.limit(20)", Facebook.HttpMethod.GET, GetScoreCallBack);
}

Callback method:

void GetScoreCallBack(FBResult _result)
{
    try 
    {
        List<object> _scoresList = Util.DeserializeScores(_result.Text);
        foreach(object _score in _scoresList)
        {
            var _entry = (Dictionary<string,object>) _score;
            var _user  = (Dictionary<string,object>) _entry["user"];

            string _userId = (string)_user["id"];

            if (string.Equals(_userId, FB.UserId))
            {
                _fbScore = GetScoreFromEntry(_entry);
                _hiScoreText.text = _fbScore.ToString();
                Debug.Log("FB SCORE: + " + _fbScore);
            }
        }
    }
    catch (System.Exception _e)
    {
        Debug.Log(_e.Message);
    }
}

As the score returned is always 0, I do not know whether the problem is with the save or load methods. Can anyone help?

To make matters worse, out of nowhere, I’ve started getting these errors when I attempt to post the score:

You are trying to load data from a www stream which had the following error when downloading.
403 Forbidden
UnityEngine.WWW:get_text()
FBResult:get_Text()
FacebookManager:<SaveScore>m__0(FBResult) (at Assets/Scripts/Facebook/FacebookManager.cs:138)
Facebook.<Start>c__Iterator0:MoveNext()

I haven’t made any changes to the code, they just started appearing every time!

Hi there, any news on this?

hey guys… did you find any solution for this???

No.

hey,did you check out your app details on fb developers ,category not select games?

Zaraku, I checked and the category is Game, subcategory Simulation.

oh…still not save score?

Did you login request “publish_actions”?

–>FB.Login(“publish_actions”, LoginCallback);

Anybody have this solution ?

Hi all,
I think its work.
Data :

void GetScoreCallBack(FBResult _result)
    {
        try
        {
            Debug.Log(_result.Text);
            Dictionary<string, object> playerScore = Json.Deserialize(_result.Text) as Dictionary<string, object>;
            object score;
            var listObject = new List<object>();
            if (playerScore.TryGetValue("data", out score))
            {
                listObject = (List<object>)score;
                var temp1 = ((Dictionary<string,object>)listObject[0]);
                Debug.Log(temp1["score"]);
            }
        }
        catch (System.Exception _e)
        {
            Debug.Log(_e.Message);
        }
    }

I will get score : 12312

Still i am not able to get score updated. I have posted bug to facebook.

hope i find solution

didu find the solution for this — anyone ???

Yeah, i guess i found the solution.
While creating a test user for your game in facebook(roles->test users), make sure to tick yes for
“Authorize Test Users for This App?” and write “publish_actions” in login permissions. Then create this test user and login with it. And your problem should be solved. (This is what worked for me.)

i need help for save fb all friend scores and show to everyone like subway surfer game…