当我尝试呈现模态视图控制器时,会发生异常:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'Attempting to begin a modal transition from <UINavigationController: 0x1d906060>
to <UINavigationController: 0x1da7a6d0> while a transition is already in progress. Wait
for viewDidAppear/viewDidDisappear to know the current transition has completed'
现在,我读到了类似的问题,他们只是稍微延迟打开了模态视图,比如
[NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(openModalController) userInfo:nil repeats:NO];
演示文稿如下所示:
- (void)openImage:(ImageModel *)imageModel{
FullscreenImageViewController_iPhone * controller = [[FullscreenImageViewController_iPhone alloc] init];
controller.imageModel = imageModel;
UINavigationController * navController = [[UINavigationController alloc] initWithRootViewController:controller];
UIViewController * visibleController = [[AppDelegate_iPhone app] visibleViewController];
[visibleController presentViewController:navController animated:YES completion:^{
}];
}
这不可能是真正的解决方案,对吗?我如何检查我的应用程序中是否正在进行某些转换,并在当前转换完成后立即打开新的模态视图?