how to change function types

Discussion in 'iOS Programming' started by eagerterrier, Feb 5, 2009.

  1. eagerterrier macrumors newbie

    Joined:
    Feb 5, 2009
    #1
    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
     
  2. caveman_uk Guest

    caveman_uk

    Joined:
    Feb 17, 2003
    Location:
    Hitchin, Herts, UK
    #2
    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.
     

Share This Page