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

guydor

macrumors member
Original poster
Mar 10, 2009
67
0
Hi,

I want to save the order of UITabBarController's tabs.
I used this code and got 2 warnings.
What should I do?

Code:
- (void)applicationDidFinishLaunching:(UIApplication *)application {     

	NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
	NSInteger tabsOrder = [defaults integerForKey:kCustomizedTabs];
	self.rootController.customizableViewControllers = tabsOrder;
	
}


- (void)applicationWillTerminate:(UIApplication *)application {
	
	NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
	NSInteger tabsOrder = self.rootController.customizableViewControllers;
	[defaults setInteger:tabsOrder forKey:kCustomizedTabs];
	
}

Edit:
Here are the warnings:
Code:
passing argument 1 of 'setCustomizableViewControllers:' makes pointer from integer without a cast
self.rootController.customizableViewControllers = tabsOrder;


initialization makes integer from pointer without a cast
NSInteger tabsOrder = self.rootController.customizableViewControllers;

Thanks!
 
What are the warnings? On what lines? Without that information I've no idea what you expect us to help you with!

Edit to add: OK, it's obvious: you are using NSInteger as an object when it's not. Use NSNumber to wrap it.
 
What's the warning?


Do you ever initialize a kCustomizedTabs variable?

Code:
NSInteger tabsOrder = [defaults integerForKey:kCustomizedTabs];

Does this actually return an integer?

Code:
self.rootController.customizableViewControllers
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.