Reputation: 440
I have an issue with upgrading to Xcode5. Before I even set about changing anything in my project I thought I would build and run it with the IOS7 3.5inch Simulator. There are two major issues and this is the main one that I cannot figure out. I have identified a line of code that has always worked perfectly until now - now whenever it runs my app crashes with an EXC_BAD_ACCESS
I've traced it to a single line of code which is my popToRoot - basically at the end of filling out a form and saving it I want to reset the view to defaults which is what I have successfully used this line of code for until now.
The code looks like this:
[self.navigationController popToRootViewControllerAnimated:NO];
With some NSLog'ing in it looks like this:
NSLog(@" self.navCon is %@", self.navigationController);
NSArray *myControllers = self.navigationController.viewControllers;
NSLog(@"myControllers Content is %@", myControllers);
NSLog(@"myControllers Count is %i", myControllers.count);
[self.navigationController popToRootViewControllerAnimated:NO];
And my log out put looks like this:
2013-11-10 00:21:32.480 trainForTri copy[9552:a0b] self.navCon is <UINavigationController: 0xb5bf580>
2013-11-10 00:21:32.481 trainForTri copy[9552:a0b] myControllers Content is (
"<SGK_T4T_01SecondViewController: 0xbaeac00>",
"<AddSessionSessTypePicker: 0xb5e51e0>",
"<SGK_T4T_01SecondViewController: 0xbb5fa00>"
)
I have noticed that the 1st and 3rd viewControllers in my viewController array are the same view, but then why has it worked on all OS's until now? And more importantly any ideas on how I can fix this?
Upvotes: 0
Views: 856
Reputation: 993
have you used arc ? check your summary settings in xcode 5.anything can be changed. problem with released object of your view controller
Upvotes: 2
Reputation: 38162
Please see if you are following these points:
popToRootViewControllerAnimated:
confirm that the RootViewController does actually exist. If it died somewhere along the line, calling the method will cause a crash. – viewWillDisappear:
and – viewDidDisappear:
methods of your last view to make sure you're not doing something dangerous there. dealloc
method of the views and their controllers to make sure your not over-releasing something. Upvotes: 0