UISplitViewController with NavigationControllers (including sample code)

前提是你 提交于 2019-12-21 05:47:10

问题


The easiest way to see this problem will be to run the sample project here:

http://drop.io/stackproblem

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.


回答1:


Try using if (self.view.window != nil) just before the line that's causing the crash.



来源:https://stackoverflow.com/questions/3874693/uisplitviewcontroller-with-navigationcontrollers-including-sample-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!