• 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
NSUserDefaults for another Application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSUserDefaults for another Application


  • Subject: NSUserDefaults for another Application
  • From: Keith Duncan <email@hidden>
  • Date: Wed, 25 Jul 2007 20:38:09 +0100

I'm writing a preference pane plugin and am trying to use the defaults system. Previously I was using NSSearchPathForDirectoriesInDomains to locate the user's library directory then append the preferences path to that. I would like to use the preferences system to avoid having to hard code the path at all.

Obviously I cannot use [NSUserDefaults standardUserDefaults] because that will return the defaults for the System Preferences app. I am unsure of how to proceed, I have read the defaults documentations topics but I am still left confused. How would I initialize an NSUserDefaults object with the correct stack of search domains for an application other than the System Preferences application? An application whose bundle identifier will be identical to that of the preference pane's bundle identifier?

If I understand it correctly when I register defaults they are volatile, i.e. not stored if they are identical to the currently set default when the defaults are synchronized to disk to save disk space. However in order to ensure the *same* defaults are registered in both my preferences application and my user agent it would be best to have a "registered defaults" plist. To me this seems to defeat the purpose of saving (albeit a minimal amount) disk space. Again, what is the best way to achieve this?

Perhaps there is some sample code which shows how to do this?

- Keith

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSUserDefaults for another Application
      • From: Benjamin Miller <email@hidden>
  • Prev by Date: Document-based cocoa application with 2 .nibs
  • Next by Date: Simple Bluetooth Question
  • Previous by thread: Re: Document-based cocoa application with 2 .nibs
  • Next by thread: Re: NSUserDefaults for another Application
  • Index(es):
    • Date
    • Thread