如何在tvOS中打开游戏中心排行榜?我已经在我的iPhone游戏中使用了此代码,但tvOS上不提供“leaderboardIdentifier”。
我计划在AppleTV上使用相同的排行榜(它将是同一游戏)。
非常感谢您的帮助,
斯特凡
@IBAction func handleGameCenter(sender: UIButton) {
let gcViewController = GKGameCenterViewController()
gcViewController.viewState = GKGameCenterViewControllerState.Leaderboards
gcViewController.leaderboardIdentifier = gamePrefix + "Leaderboard"
gcViewController.gameCenterDelegate = self
// Show leaderboard
self.presentViewController(gcViewController, animated: true, completion: nil)
}
func gameCenterViewControllerDidFinish(gameCenterViewController: GKGameCenterViewController) {
gameCenterViewController.dismissViewControllerAnimated(true, completion: nil)
}
最佳答案
我也遇到了“无可用数据”屏幕的问题,但终于解决了。这对我来说可以在tvOS上打开gamecenter排行榜:
GKGameCenterViewController *gcViewController = [[GKGameCenterViewController alloc] init];
gcViewController.gameCenterDelegate = self;
[self presentViewController:gcViewController animated:YES completion:nil];
关于game-center - 如何在tvOS中打开GameCenter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32770956/