Take a look at the following methods in NSUserDefaults:
- (NSDictionary *)persistentDomainForName:(NSString *)domainName; - (void)setPersistentDomain:(NSDictionary *)domain forName:(NSString *)domainName; - (void)removePersistentDomainForName:(NSString *)domainName;
They allow you to read and write to the settings file with a given domain name. An example is reading some general settings for Apple iApps:
NSUserDefaults* prefs = [ NSUserDefaults standardUserDefaults ]; NSDictionary* iAppsPrefs = [ prefs persistentDomainForName: @"com.apple.iApps" ]; NSArray* recentPaths = [ iAppsPrefs objectForKey: @"iTunesRecentDatabasePaths" ];
The previous code reads an array of the latest paths for iTunes database files.
The disadvantage of these methods is that they read and write the entire contents of the file. If the stored item numbers are not very large, this is usually not a problem.
source share