[英]Game Center score submitted, but leaderboard shows no score
I have a game that uses Game Center. 我有一个使用Game Center的游戏。
I'm playing the game, when the game ends, I send my score to GC. 我正在玩游戏,游戏结束时,我会将分数发送给GC。 After that, I'm checking my score with the method below.
之后,我将使用以下方法检查分数。
- (void)showLeaderboard
{
GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init];
if (leaderboardController != NULL)
{
leaderboardController.category = self.currentLeaderBoard;
leaderboardController.timeScope = GKLeaderboardTimeScopeAllTime;
leaderboardController.leaderboardDelegate = self;
UnityAppController* delegate = (UnityAppController*)[[UIApplication sharedApplication] delegate];
[[delegate rootViewController] presentViewController:leaderboardController animated:YES completion:nil];
}
}
That's just working fine, when I check it I can see my recent score on the leaderboard. 一切正常,当我检查它时,可以在排行榜上看到我最近的成绩。
But the problem starts after. 但是问题开始了。 The next day, when I check it again with the
showLeaderboard()
method, the leaderboard says "no score". 第二天,当我再次使用
showLeaderboard()
方法进行检查时,页首横幅显示“没有得分”。 If I play the game and send my score again it's just working fine again, I can see my score! 如果我玩游戏并再次发送分数,则表示一切正常,我可以看到分数! But, the next day the leaderboard says "no score" to me again!
但是,第二天排行榜再次对我说“不得分”! Like the leaderboard resets itself at 00.00 o'clock.. Just awkward..
就像排行榜在00:00时重置自己一样。.尴尬..
Any suggestions? 有什么建议么? Thanks in advance..
提前致谢..
Just make sure that you do the correct code for submitting the score. 只需确保您输入提交分数的正确代码即可。 This is a way that I really like.
我真的很喜欢这种方式。 Even though you will get warnings because they don't want you to use it in iOS 7, it still works.
即使您会因为他们不希望您在iOS 7中使用它而收到警告,它仍然可以工作。 Just let me know if it doesn't work.
请让我知道它是否无效。
(IBAction)submitscoretogamecenter{
GKLocalPlayer *localplayer = [GKLocalPlayer localPlayer];
[localplayer authenticateWithCompletionHandler:^(NSError *error) {
}];
//This is the same category id you set in your itunes connect GameCenter LeaderBoard
GKScore *myScoreValue = [[[GKScore alloc] initWithCategory:@"insertCategory"] autorelease];
myScoreValue.value = scoreInt;
[myScoreValue reportScoreWithCompletionHandler:^(NSError *error){
//insert what happens after it's posted
}];
[self checkAchievements];
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.