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

eagerterrier

macrumors newbie
Original poster
I have a controller that I want to be in charge of getting and setting preferences in the plist files

And I have some code like this

Code:
Prefs *prefController = [[Prefs alloc] init];
	NSString *cachingOn = [prefController getPreference:@"cachingOn"];

	NSLog(@"The preference is *%@*",cachingOn);
	
	if([cachingOn isEqual:@"on"]){
		NSLog(@"Caching is on!");
		
	}

Now this works fine. Just great. However, when I have plist nodes that are boolean or date etc, this code just doesn't cut it.

The problem is that my Prefs->getPreference method returns an NSString.

My question is, how do I get the method to return whatever data type the plist node is?

Thanks


TC
 
What's wrong with the built in preferences system using NSUserDefaults? This would seem to do everything you want.

Anyway, in answer to your question is to make the return type id.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.