我开发了一个简单的游戏,我使用Facebook SDK统一进行排名,一切都与TestUsers一起工作但是在我发布之后,排名不适用于普通用户。
FB.login可能有些问题吗?
FB.Login("email, publish_actions", AuthCallback);
或者我的保存分数代码?我不这么认为,b / c适用于测试用户
// 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);
}
答案 0 :(得分:0)
只是意识到测试用户在FB.Login中跳过了权限,所以在应用程序中你应该使用 FB.Login 中的所有权限。
FB.Login("email, publish_actions", AuthCallback);
到
FB.Login("email, publish_actions, user_friends, public_profile", AuthCallback);