Search code examples
iphonesettingsnsuserdefaultsapplication-settings

initial settings of NSUserDefaults


So I was reading this: Storing iPhone application settings in app which seems simple enough.

However, where/how would I define the initial settings?

So for instance I have a Country setting: UK or USA. When the app is first installed/opened I want it to automatically know/set NSUserDefaults to UK.

I hope this is clear ha.

Tom


Solution

  • You can use the -registerDefaults: method to set up the "default defaults":

    http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/UserDefaults/Tasks/UsingDefaults.html#//apple_ref/doc/uid/20000719-BAJFBAAH