Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 5 -- presentModalViewController nils parentViewController in "self"?

I'm still trying to figure out some iOS 5 vs iOS 4 problems in this incredibly (and unnecessarily) complicated app.

I've traced one problem down to the fact that a controller (which happens to be the navigation controller of the calling class) has a parentViewController attached prior to being "sent" a presentModalViewController request, but on the other side of that (in viewWillAppear of the "presented" controller -- haven't even returned from the call) the navigation controller (I've verified that it's the same address) suddenly has a nil parentViewController.

I'm reasonably certain that this behavior did not occur in iOS 4 (I've been ping-ponging back and forth between the two versions to verify behaviors).

The code is far too complicated to include here, but the call is:

[self.navigationController presentModalViewController:messageViewController animated:[self isAnimated]];

There are assertions prior to the call that the parentViewController of the nav ctlr is non-nil, and likewise in viewWillAppear. The assertion only fails in viewWillAppear.

like image 484
Hot Licks Avatar asked Dec 22 '22 06:12

Hot Licks


2 Answers

It was in the manual: Change in iOS5

like image 178
Hot Licks Avatar answered Jan 12 '23 00:01

Hot Licks


More good information about this iOS5 change: http://omegadelta.net/2011/11/04/oh-my-god-they-killed-parentviewcontroller/

like image 25
Manni Avatar answered Jan 12 '23 01:01

Manni