3

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.

user229044
  • 232,980
  • 40
  • 330
  • 338
Morgz
  • 574
  • 6
  • 15
  • Do search before asking question... here is same question..[SO Question 1](http://stackoverflow.com/questions/3377001/popovers-cannot-be-presented-from-a-view-which-does-not-have-a-window) – k-thorat Oct 06 '10 at 16:41
  • How do you know? I've read this thread already today and couldn't see it as a suitable answer to the question above. Yes it's the same exception but different situation. – Morgz Oct 06 '10 at 16:53
  • Or to rephrase.. How can I use that answer to stop this crash? – Morgz Oct 06 '10 at 16:55
  • The question you link to is totally different from this question. – MikeN Jan 04 '11 at 18:03
  • I am not sure whats wrong. but this is not the link which I posted... strange though. – k-thorat Jan 04 '11 at 19:58
  • Has this problem been solved ? I am looking for the same solution. – Viraj Feb 23 '11 at 14:04
  • Sorry I chose a different solution and left this creepy little bug alone... – Morgz May 12 '11 at 10:27

1 Answers1

1

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

Mustafa
  • 20,504
  • 42
  • 146
  • 209