I have navigation application. I have created a UINavigationController in application didFinishLaunchingWithOptions of appdelegate. self.initialviewcontroller = [[InitialViewController alloc] initWithNibName:@"InitialViewController" bundle:nil]; UINavigationController *myNavController = [[UINavigationController alloc] initWithRootViewController:self.initialviewcontroller];
self.window.rootViewController = myNavController; [self.window makeKeyAndVisible];
In the InitialViewController i have button which will navigate to SecondViewController. So, in the IBAction of button i push the SecondViewController as follows,
if(self.secondView != nil)
self.secondView = nil;
self.secondView = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
self.navigationController pushViewController:self.secondView animated:YES];
Situation : The navigation is working fine, i am bale to navigate between InitialViewController to SecondViewController. When i am in SecondViewController and press home button of device, the application is entered into background and when i reopen the app it opens the app from where i closes(i.e SecondViewController). Now if i press the back button to go to InitialViewController, the app is crashing.
It's working fine in the ios simulator,but crashes occurs on devices.
I didn't understand what the mistake i have done. Please let me know any idea. Thanks in advance....