Re: NSUserDefaults for portable applications
Re: NSUserDefaults for portable applications
- Subject: Re: NSUserDefaults for portable applications
- From: "David V. Kocher" <email@hidden>
- Date: Wed, 22 Feb 2006 19:46:07 +0100
I have just noticed this will still save the preferences in ~/Library/
Preferences/<bundleIdentifier>.plist in addition to the custom
location. The documentation is not clear to me how to override the
default location. I have also tried using
setPersistentDomain:forName: with the bundle identifier as the
argument for domain but that makes no difference.
An option would be to just work with an NSDictionary but that will
still save settings from components with the 'Autosave' option set in
Interface Builder to the default location.
There must be someting I haven't grasped yet; thanks for any
additional input.
/dk
On 13.02.2006, at 10:17, Conor Dearden wrote:
What would you suggest as best practice to make the application
preferences portable (so the application won't modify and store
preferences on the 'guest' system)?
NSUserDefaults is a simply a plist dictionary. You can save your
own and
load your own dictionary at a specified path (on your mobile media) at
applicationWillFinishLaunching and applicationWillTermiante
delegate methods
or notification.
Load
1. load dictionary with dictionaryWithContents... convenience method
2. NSUserDefualts - (void)registerDefaults:(NSDictionary *)dictionary
Quit
1. (NSDictionary *)persistentDomainForName:(NSString *)domainName
(com.mycompany.myapp)
2. save to file with writeToFile...
Conor
www.bruji.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden