【问题标题】:Game Center score submitted, but leaderboard shows no scoreGame Center 分数已提交,但排行榜显示没有分数
【发布时间】:2013-07-30 15:37:01
【问题描述】:

我有一个使用 Game Center 的游戏。

我正在玩游戏,当游戏结束时,我将我的分数发送给 GC。之后,我用下面的方法检查我的分数。

- (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];

    }
}

这很好,当我检查它时,我可以在排行榜上看到我最近的得分。

但问题开始后。第二天,当我再次使用showLeaderboard() 方法查看时,排行榜显示“无分数”。如果我玩游戏并再次发送我的分数,它会再次正常工作,我可以看到我的分数!但是,第二天排行榜又对我说“没有得分”!就像排行榜在 00.00 点自动重置一样.. 很尴尬..

有什么建议吗?提前谢谢..

【问题讨论】:

    标签: ios center leaderboard


    【解决方案1】:

    只需确保您使用正确的代码提交分数即可。这是我非常喜欢的一种方式。即使您会收到警告,因为他们不希望您在 iOS 7 中使用它,但它仍然有效。如果它不起作用,请告诉我。

    (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];
    

    }

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-18
      • 2018-02-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多