0

我正在使用 GKAchievementViewController 来显示成就。它在大多数设备上都能正常工作,但在某些设备上(iPod Touch 第 3 代和运行 iOS 5.1.1 的 iPad 1)点击完成按钮不起作用。

我不知道如何调试这个......

这是我用来显示成就的代码:

    viewController = [[GKAchievementViewController alloc] init];
    if (viewController)
    {
        viewController.achievementDelegate = self;

        [self presentModalViewController:viewController animated:YES];
    }

进而:

- (void)achievementViewControllerDidFinish:(GKAchievementViewController *)aViewController
{
     [self dismissModalViewControllerAnimated:YES];
}
4

2 回答 2

0

实施时应该工作achievementViewControllerDidFinish:

- (void) achievementViewControllerDidFinish:(GKAchievementViewController *)viewController
{
    [viewController.delegate dismissModalViewControllerAnimated:YES];
}
于 2013-03-14T02:28:07.113 回答
0

如果有人遇到同样的问题,请回答我自己的问题。这似乎解决了这个问题:

- (void)achievementViewControllerDidFinish:(GKAchievementViewController *)aViewController
{
        if ([self respondsToSelector:@selector(dismissViewControllerAnimated:completion:)])
        {
            [self dismissViewControllerAnimated:YES completion:^{
                aViewController.achievementDelegate = nil;
                [aViewController release];
            }];
        }
        else
        {
            [self dismissModalViewControllerAnimated:YES];
            aViewController.achievementDelegate = nil;
            [aViewController release];
        }
}
于 2013-03-15T17:11:47.663 回答