IOS 7 用にアプリを更新しました。ゲーム センターには、リーダーボードと実績の読み込みと破棄など、いくつかの非推奨の機能があります。GKLeaderboardViewController は非推奨と表示されます。
- (IBAction)LeaderBoardsButton:(id)sender {
GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init];
if (leaderboardController != NULL)
{
leaderboardController.leaderboardDelegate = self;
[self presentViewController:leaderboardController animated:YES completion:NULL];
}
{
AudioServicesPlaySystemSound(SoundID);
}
}
- (void)leaderboardViewControllerDidFinish:(GKLeaderboardViewController *)viewController
{
[self dismissViewControllerAnimated:YES completion:NULL];
{
AudioServicesPlaySystemSound(SoundID2);
}
}
- (IBAction)AchievementsButton:(id)sender {
GKAchievementViewController *achievements = [[GKAchievementViewController
alloc] init];
if (achievements != nil)
{
achievements.achievementDelegate = self;
[self presentViewController:achievements animated:YES completion:NULL];
}
{
AudioServicesPlaySystemSound(SoundID);
}
}
- (void)achievementViewControllerDidFinish:(GKAchievementViewController
*)viewController
{
[self dismissViewControllerAnimated:YES completion:NULL];
{
AudioServicesPlaySystemSound(SoundID2);
}
}
私はこのようにスコアを報告しています
- (IBAction)ShareScore:(id)sender {
[self.gameCenterManager reportScore: counter forCategory: self.currentLeaderBoard];
GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init];
if (leaderboardController != NULL)
{
leaderboardController.category = self.currentLeaderBoard;
leaderboardController.timeScope = GKLeaderboardTimeScopeToday;
leaderboardController.leaderboardDelegate = self;
[self presentViewController:leaderboardController animated:YES completion:NULL];
}
{
AudioServicesPlaySystemSound(SoundID);
}
}