PDA

View Full Version : App Not Saving Tab Order & "SIGABRT" Error




kwjohns
Jul 19, 2009, 01:08 PM
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:

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):

- (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). :confused:



kwjohns
Jul 19, 2009, 02:35 PM
Problem has been solved. I didn't have some titles set within Interface Builder that the code was looking for therefore the string was a null value.