排行榜得分未出现在游戏中心

时间:2014-03-10 12:51:18

标签: objective-c ios7 xcode5 game-center

我为自己的应用创建了一个排行榜。它显示在游戏中心,但从未提交分数。

我使用以下代码提交了测试分数:

GKScore* gkScore;

// Set the score value
gkScore.value = gameTimer;

// Send the score to Game Center
[gkScore reportScoreWithCompletionHandler:^(NSError* error) {}];

1 个答案:

答案 0 :(得分:0)

这是我用来提交适合我的分数的功能

- (void) reportScore: (int64_t) reportScore forLeaderboardID: (NSString*) identifier
{
    GKScore *scoreReporter = [[GKScore alloc] initWithLeaderboardIdentifier: identifier];
    scoreReporter.value = reportScore;
    scoreReporter.context = 0;

    NSArray *scores = @[scoreReporter];
    [GKScore reportScores:scores withCompletionHandler:nil];

}

此外,请确保您的排行榜处于实时状态或已添加到新版本提交中。 itunesConnect>你的应用>查看新版本的详细信息>如果尚未添加新的排行榜,Game Center会添加新的排行榜。

相关问题