I am loading a UIViewController from a package with initWithNibName:bundle: If I set a breakpoint in viewDidLoad , I see that its view . I also see this when viewing About.xib in the interface builder.
However, as soon as the view is used for the first time (when I call [self.navigationController pushViewController:viewController animated:YES] according to my application logic), I get this error:
* Application termination due to the uncaught exception "NSInternalInconsistencyException", reason: '- [UIViewController _loadViewFromNibNamed: bundle:] loaded "O", but the exit viewpoint was not set. ''
This is a call that also calls viewDidLoad . Thus, it is obvious that during the call, view is the first non-nil (as it should be), and later, obviously, becomes nil again.
If I alternatively type po [viewController view] in the debugger just before the call, I get this error (which is supposedly just a different representation of the same symptom):
Error: execution aborted, reason: ObjC internal exception breakpoint (-3). The process was returned to the state before evaluating the expression.
How can I download and use the view controller in conjunction with an existing navigation bar without getting into these errors?
UPDATE The problem seems to disappear if I load the view controller from my storyboard (not necessarily my main storyboard), and not from the XIB file.
source share