Friends Ranking doesn't showing up, but works with test users

330 Views Asked by At

I developed a simples game and I use Facebook SDK for unity to make the part of ranking, everything is working fine with the TestUsers but after i published it, the ranking is not working with normal users.

I have the permission of Publish_actions

The game is live on Facebook

Maybe some problem with FB.login ?

    FB.Login("email, publish_actions", AuthCallback);

OR something with my code of saving scores? I dont think so, b/c works with test users

    // All Scores API related Things

public void QueryScores()
{
    FB.API ("/app/scores?fields=score,user.limit(30)", Facebook.HttpMethod.GET, ScoresCallback);
}

private void ScoresCallback(FBResult result)
{
    Debug.Log ("Scores callback: " + result.Text);

    scoresList = Util.DeserializeScores (result.Text);

    foreach (Transform child in ScoreScrollList.transform) 
    {
        GameObject.Destroy (child.gameObject);
    }

    foreach (object score in scoresList) 
    {

        var entry = (Dictionary<string,object>) score;
        var user = (Dictionary<string,object>) entry["user"];

        GameObject ScorePanel;
        ScorePanel = Instantiate (ScoreEntryPanel) as GameObject;
        ScorePanel.transform.parent = ScoreScrollList.transform;

        Transform ThisScoreName = ScorePanel.transform.Find ("FriendName");
        Transform ThisScoreScore = ScorePanel.transform.Find ("FriendScore");
        Text ScoreName = ThisScoreName.GetComponent<Text>();
        Text ScoreScore = ThisScoreScore.GetComponent<Text>();

        ScoreName.text = user["name"].ToString();
        ScoreScore.text = entry["score"].ToString();

        Transform TheUserAvatar = ScorePanel.transform.Find ("FriendAvatar");
        Image UserAvatar = TheUserAvatar.GetComponent<Image>();


        FB.API (Util.GetPictureURL(user["id"].ToString (), 128,128), Facebook.HttpMethod.GET, delegate(FBResult pictureResult){

            if(pictureResult.Error != null) // if there was an error
            {
                Debug.Log (pictureResult.Error);
            }
            else // if everything was fine
            {
                UserAvatar.sprite = Sprite.Create (pictureResult.Texture, new Rect(0,0,128,128), new Vector2(0,0));
            }

        });



    }


}

public void SetScore()
{
    string highScore = PlayerPrefs.GetInt("recorde").ToString();

    var scoreData = new Dictionary<string,string> ();
    scoreData ["score"] = highScore;
    FB.API ("/me/scores", Facebook.HttpMethod.POST, delegate(FBResult result) {
        Debug.Log ("Score submit result: " + result.Text);
        if(result.Text == "{\"success\":true}"){
            QueryScores();
        }
    }, scoreData);
}
1

There are 1 best solutions below

0
On

Just realize that Test Users skip the permission in FB.Login, so in the app you should use all the permissions in FB.Login.

   FB.Login("email, publish_actions", AuthCallback);

to

   FB.Login("email, publish_actions, user_friends, public_profile", AuthCallback);