• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSUserDefaults for portable applications
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: NSUserDefaults for portable applications
      • From: Conor Dearden <email@hidden>
References: 
 >Re: NSUserDefaults for portable applications (From: Conor Dearden <email@hidden>)

  • Prev by Date: Re: CFPrefDockItems sample code. Where did it go?
  • Next by Date: Re: NSTableView and background color
  • Previous by thread: Re: NSUserDefaults for portable applications
  • Next by thread: Re: NSUserDefaults for portable applications
  • Index(es):
    • Date
    • Thread