Hot Licks
Hot Licks

Reputation: 47729

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.

Upvotes: 4

Views: 3023

Answers (2)

Hot Licks
Hot Licks

Reputation: 47729

It was in the manual: Change in iOS5

Upvotes: 9

Manni
Manni

Reputation: 11148

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

Upvotes: 2

Related Questions