Reputation: 1154
I was trying to redo an example of How to create UINavigationController based application from Beginning iPhone Development by Appress.
I'm getting the following exception:
Exception: Pushing a navigation controller is not supported
Exception: [NSException]:Pushing a navigation controller is not supported
ex.name:'NSInvalidArgumentException'
ex.reason:'Pushing a navigation controller is not supported'
It happens when user try to push a view that is already in the stack, Which is not true in my case.
My_3AppDelegate.h
IBOutlet UINavigationController * navController;
@property (nonatomic, retain) UINavigationController * navController;
My_3AppDelegate.m
[window addSubview: navController.view];
MainWindow.xib
adds UINavigationController
to the window an connected to the outlet.
The only difference in my code is RootViewController
is not a subclass of UITableViewController
. It's just UIViewController
with 2 UIbutton
s.
FirstViewController *fv = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
fv.navigationItem.title=@"First View Controller";
[self.navigationController pushViewController:fv animated:NO];
[fv release];
That error occurs with the initial run of the application, which make sure that, It's not like that, the view was already added to the stack and I'm trying to readied.
Its a very simple tutorial application that I'm stuck in and I'm not sure why?
Any idea?
Upvotes: 0
Views: 6439
Reputation: 4140
I've solved the same problem by changing super class from UINavigationCotroller to UIViewController.
Upvotes: 2