1

我尝试使用 Game Center 显示我的游戏的排行榜。当我在游戏中单击游戏中心按钮时,将调用以下内容:

- (void)showGameCenterButtonPressed:(id)sender {
{
    if ([GKLocalPlayer localPlayer].authenticated == NO) {
        UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"You must enable Game Center!"
                                                          message:@"Sign in through the Game Center app to enable all features"
                                                         delegate:nil
                                                cancelButtonTitle:@"OK"
                                                otherButtonTitles:nil];
        [message show];
    } else {
        GKGameCenterViewController *gameCenterController = [[GKGameCenterViewController alloc] init];
        if (gameCenterController != nil)
        {
            gameCenterController.gameCenterDelegate = self;
            gameCenterController.viewState = GKGameCenterViewControllerStateLeaderboards;
            gameCenterController.leaderboardIdentifier = @"MyScore";
            UIViewController *vc = self.view.window.rootViewController;
            [vc presentViewController: gameCenterController animated: YES completion:nil];
        }
    }
}

}

我还有一个报告评分方法:

-(void)reportScore {
if ([GKLocalPlayer localPlayer].isAuthenticated) {
    GKScore *scoreReporter = [[GKScore alloc]  initWithLeaderboardIdentifier:@"MyScore"      forPlayer:[GKLocalPlayer localPlayer].playerID];
    scoreReporter.value = _highScore;
    NSLog(@"Score reporter value: %@", scoreReporter);
    [GKScore reportScores:@[scoreReporter] withCompletionHandler:^(NSError *error) {
        if (error != nil) {
            NSLog(@"Error");
            // handle the reporting error
        }

    }];
}

}

现在游戏中心窗口向上滑动,显示游戏标题,但显示“没有排行榜”

我认为这可能是 iTunes Connect 问题.. Bundle Identifier 是正确的,并且 Game Center 已启用。对此有任何想法吗?非常感谢!

4

0 回答 0