• 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
Defaults registration
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Defaults registration


  • Subject: Defaults registration
  • From: Ondra Cada <email@hidden>
  • Date: Tue, 25 Apr 2006 15:21:09 +0200

Incidentally...

On Apr 25, 2006, at 3:03 PM, Paul Lynch wrote:

Look at NSPropertyListSerialization and NSDictionary dictionaryWithContentsOfFile:, and read Property List Programming Guide for Cocoa - that's how to read a plist; it's not immediately obvious how to hook this in with NSUserDefaults, but it's not exactly hard, either. (Hint given rather than an explicit solution)

Perhaps it is just a difference in programming style, but myself, I've found that registering defaults from a hard-coded "dictionaryWithObjectsAndKeys" is in very vast majority of cases the best course. Registered defaults in plists are neat, but in my experience in 99.99 % of projects, including pretty complex ones, it is not worth the hassle, for this kind of flexibility just is not needed: never ever have I changed the default plists without recompiling the application itself :)


(Still there are cases when this gets handy, e.g., you may want to load the default plists from bundles and register them automagically before *either* the bundle itself gets loaded *or* the prefs panel gets opened, whatever comes first; but I would consider this a pretty advanced technique and would not teach it in Cocoa 101 :))

Is it just me?
---
Ondra Čada
OCSoftware:     email@hidden               http://www.ocs.cz
private         email@hidden             http://www.ocs.cz/oc


_______________________________________________ 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: Defaults registration
      • From: Paul Lynch <email@hidden>
References: 
 >Newbie questions (From: Xavier Elizalde <email@hidden>)
 >Re: Newbie questions (From: Paul Lynch <email@hidden>)

  • Prev by Date: Re: Temporary object created at runtime with Core Data
  • Next by Date: Re: Temporary object created at runtime with Core Data
  • Previous by thread: Re: Newbie questions
  • Next by thread: Re: Defaults registration
  • Index(es):
    • Date
    • Thread