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?
Share
Not sure how your code is structured, but every
UIViewControllerhas anavigationControllerproperty. (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 (whateverselfis), not what you’ve named in your AppDelegate.