I have an app that has more than 5 tabs, therefore I'm implementing code to save the tab order if the user wishes to change it. I have another app that works fine and I'm implementing the same code into the 2nd app but it is throwing fits. It's not saving the tab order and when I debug on the device and exit the application, it doesn't quit the debugger and throws me:
Here is the code in my app delegate that I believe to be causing this error (when I take it out no SIGABRT error):
Like I said, I'm using this same code for another app and it works fine (with the exception of the array capacity being 8 on the other app).
terminate called after throwing an instance of 'NSException'
Program received signal: SIGABRT.
Here is the code in my app delegate that I believe to be causing this error (when I take it out no SIGABRT error):
Code:
- (void)applicationWillTerminate:(UIApplication *)application {
NSMutableArray *savedOrder = [NSMutableArray arrayWithCapacity:7];
NSArray *tabOrderToSave = tabBarController.viewControllers;
for (UIViewController *aViewController in tabOrderToSave) {
[savedOrder addObject:aViewController.title];
}
[[NSUserDefaults standardUserDefaults] setObject:savedOrder forKey:@"savedTabOrder"];
}
Like I said, I'm using this same code for another app and it works fine (with the exception of the array capacity being 8 on the other app).