4
香港專業教育學院更新我的應用程序的IOS 7和遊戲中心已棄用,如裝載和解聘排行榜和成就如何解決他們的幾件事情,它說GKLeaderboardViewController已被棄用我應該使用iOS7中的什麼來代替已棄用的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);
}
}
嗨格里格工作完美我編輯了問題,因爲我錯過了報告分數部分我將如何解決? – Azabella
我怎麼會觸發無效聲明,因爲我希望在比賽結束就引發,當他們提交有得分 – Azabella
你是說你怎麼罵的reportHighScore:forLeaderboardId:方法?這將類似於你在上面寫的這一行:[self.gameCenterManager reportScore:counter forCategory:self.currentLeaderBoard] ;.相反,你會做一些像[self reportHighScore:counter forLeaderboardId:self.currentLeaderBoard] ;. – Greg