问题描述
查看此问题的最简单方法是在此处运行示例项目:
基本上,这是一个uisplitviewcontroller,可以在2个细节视图之间切换,是导航控制器。
问题是它崩溃,出现以下错误:
MultipleDetailViews [8531:207 ] 由于未捕获异常NSInvalidArgumentException而终止应用程序,原因:无法从没有窗口的视图显示Popovers。 p>如果您使用PORTRAIT中的应用程序,并从第一个控制器导航(仍然是纵向),第二个,第一个,第二个,然后使用popover控制器进行boom CRASH,则会出现此错误。 p>
停止宕机的一种方法是停止延迟加载导航控制器,并每次都加载新的,但这不是我做的应用程序的选项。
尝试使用if (self.view.window!= nil)就在导致崩溃的行之前。
The easiest way to see this problem will be to run the sample project here:
Basically, It's a uisplitviewcontroller which can be switched between 2 detail views, both of which are navigation controllers.
The problem is that it crashes with the following error:
MultipleDetailViews[8531:207] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Popovers cannot be presented from a view which does not have a window.'
It crashes with this error if you use the app in PORTRAIT and you navigate (still in portrait) from the first controller, to the second, to the first, to the second, and then boom CRASH using the popover controller.
One way to stop the crash is to stop lazy loading the navigation controllers and to load them fresh everytime but this isn't an option for the app I'm making.
Any ideas and I may fall in love.
Try using if (self.view.window != nil) just before the line that's causing the crash.
这篇关于带有NavigationControllers的UISplitViewController(包括示例代码)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!