尝试在转换时关闭演示控制器 [英] Trying to dismiss the presentation controller while transitioning already

查看:629
本文介绍了尝试在转换时关闭演示控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iOS8 GM上使用Xcode6 GM编译我的项目。当解雇许多视图控制器时,我的应用程序总是崩溃并且调试区域显示:

I compile my project using Xcode6 GM on iOS8 GM. When dismissing many view controllers, my app always crashes and the debug area shows:


在转换时尝试关闭演示控制器。
transitionViewForCurrentTransition未设置,演示文稿控制器在演示期间被解雇?

"Trying to dismiss the presentation controller while transitioning already. transitionViewForCurrentTransition is not set, presentation controller was dismissed during the presentation? "

我用Google搜索并找到类似案例并显示同样的错误:

I have googled and find a similar case and shows the same error:

[self.viewController presentViewController:vc animated:NO completion:^{
        [self.viewController dismissViewControllerAnimated:NO completion:nil];
}];

使用Xcode5和iOS7可以正常工作。错误意味着什么? iOS8对黑客不满意吗?在此先感谢。

It works fine using Xcode5 and iOS7 . What does the error means? Is iOS8 isn't happy with the "Hack"? Thanks in advance.

推荐答案

我的解决方案:


dismissViewControllerAnimated:completion :如果连续呈现多个视图控制器,从而构建一堆呈现的视图控制器,则在堆栈中较低的视图控制器上调用此方法会解除其直接子视图控制器以及堆栈上该子项上方的所有视图控制器。发生这种情况时,只有最顶层的视图以动画方式被删除;任何中间视图控制器都可以从堆栈中删除。

dismissViewControllerAnimated:completion:If you present several view controllers in succession, thus building a stack of presented view controllers, calling this method on a view controller lower in the stack dismisses its immediate child view controller and all view controllers above that child on the stack. When this happens, only the top-most view is dismissed in an animated fashion; any intermediate view controllers are simply removed from the stack.

例如,我有4个视图:A-> B-> C-> D当我想解雇B时,我首先检查C是否也想通过使用objc_setAssociatedObject来附加/分离NSString对象来解除,如果C也想解雇,那么只需取消C的请求。只需要调用解除给B。

For example,I have 4 views:A->B->C->D and when I want to dismiss B, I firstly check if C also want to dismiss by using objc_setAssociatedObject to attach/detach a NSString object, and if C wants to dismiss too,then just cancel C's request.Just call dismiss to B.

这篇关于尝试在转换时关闭演示控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆