views:

33

answers:

1

When I try to push a view controller to my UINavigationController I get a NSInvalidArgumentException thrown with the error message "unrecognized selector sent to instance". But this only happens when I name my UINavigationController ivar anything other than "navigationController". Is there a reason for this?

A: 

Not sure how your code is structured, but every UIViewController has a navigationController property. (See http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html)

So, [self navigationController] is returning the property from the current view controller (whatever self is), not what you've named in your AppDelegate.

Eric