我有一个单例类来处理我所有的游戏中心的东西。我已将其设置为 GKAchievementViewControllerDelegate 的代表。
我将以下方法称为 showAchievements
- (void) showAchievements
{
GKAchievementViewController *achievements = [[GKAchievementViewController alloc] init];
if (achievements != nil)
{
achievements.achievementDelegate = self.delegate;
[self.viewController presentModalViewController: achievements animated: YES];
}
}
我实现了以下
- (void)achievementViewControllerDidFinish:(GKAchievementViewController *)achievements
{
[self.viewController dismissModalViewControllerAnimated: YES];
}
在调用 showAchievements 之前,我使用以下代码设置 self.viewController
AppController* appDelegate = (AppController*)[[UIApplication sharedApplication] delegate];
[GameCenterManager instance].viewController = appDelegate.window.rootViewController;
当我调用 showAchievements 时,应用程序崩溃并在控制台日志中显示以下内容。
Jul 16 12:36:28 imac-3 myApp[17103] <Info>: 12:36:28.287698 com.apple.AVConference: GKSConnSettings: set server: {
"gk-cdx" = "17.173.254.218:4398";
"gk-commnat-cohort" = "17.173.254.220:16386";
"gk-commnat-main0" = "17.173.254.219:16384";
"gk-commnat-main1" = "17.173.254.219:16385";
}
在我调用 showAchievements 时,用户已成功登录。
知道我在这里可能做错了什么吗?