views:

414

answers:

1

I have an view-based application where the user can do a lot of customization things, like selecting colors, selecting pictures, and so on.

First, I thought about using sqlite3 for that, but since this would result in a table with only one row (no multi-user app), it seems like a big overhead to me. Then I heard about NSUserDefaults. But I am not sure where this data is stored. Is it stored in the app's sandbox? Or is it stored somewhere else? Do other apps have access to that data? Is it good for remembering this kind of customization stuff?

+9  A: 

The NSUserDefaults class is meant for storing user preferences for your application. It's stored in a plist file in the application's sandbox Library directory.

[[NSUserDefaults standardUserDefaults] setObject:@"Test" forKey:@"myPref"];
NSString *val = [[NSUserDefaults standardUserDefaults] stringforKey:@"myPref"];
Jason Harwig
How does that answer the question in the title?
Mikle