How can I open a game center leaderboard in tvOS? I've used this code for my iPhone games, 'leaderboardIdentifier' aren't available on tvOS.
I've planned to use the same leaderboard on the AppleTV (it will be the same game).
Many thanks for your help, Stefan
@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)
}
I also had the problem with "No data available" screen but finally solved it. This worked for me to open gamecenter leaderboard on tvOS:
use this code to open the leaderboard:
GKGameCenterViewController *gcViewController = [[GKGameCenterViewController alloc] init];
gcViewController.gameCenterDelegate = self;
[self presentViewController:gcViewController animated:YES completion:nil];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With