Reputation: 43
I use "plist" files to store my settings. The only answer I found is to save the files from this directory:
NSString *rootPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
But I don't know how to do that thing.
Upvotes: 0
Views: 334
Reputation: 12036
Read the docs: NSUserDefaults
The NSUserDefaults class provides a programmatic interface for interacting with the defaults system. The defaults system allows an application to customize its behavior to match a user’s preferences. For example, you can allow users to determine what units of measurement your application displays or how often documents are automatically saved. Applications record such preferences by assigning values to a set of parameters in a user’s defaults database. The parameters are referred to as defaults since they’re commonly used to determine an application’s default state at startup or the way it acts by default.
So you can save and read your settings in and from NSUserDefaults.
//write to standard defaults
[[NSUserDefaults standardUserDefaults] setObject:yourObject forKey:@"kYourKey"];
[[NSUserDefaults standardUserDefaults] synchronize];
//read from standard defaults
yourObject = [[NSUserDefaults standardUserDefaults] objectForKey:@"kYourKey"];
Next time try to be more specific of what you want to do.
Upvotes: 4