Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

kwjohns

macrumors 6502a
Original poster
Jul 4, 2007
700
12
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):

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). :confused:
 
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.