• 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: What writes out a pref file?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What writes out a pref file?


  • Subject: Re: What writes out a pref file?
  • From: Mark Dawson <email@hidden>
  • Date: Thu, 14 Apr 2005 19:29:17 -0700

This is correct behaivor.

You don't see the value in your app's preferences file because you haven't changed the value. Registration defaults are the baseline set of values to be used for the defaults. That is, they are the values that the program will use if there wasn't a custom value found in the user defaults.
OK. I was more used to the "everything written out model", with user's (advanced) being able to snoop/change the defaults by modifying the preferences. I didn't quite see this explained this way in the documentation. Thanks!

Imagine this; at some later date, you decide the out-of-the-box default should be "Radians" instead of whatever is returned by "AppleMeasurementUnits". By using a registration default, every user of your app that never changed away from the default value will automatically start using 'radians' instead. At the same time, any user that customized the default value will have their custom default value preserved.
I could see how this would reduce the "please destroy your prefs" type message that some upgrades require (or do manually), as its not as much of an issue.

If you were to call [[NSUserDefaults standardUserDefaults] setStringValue: @"Radians" forKey: @"MyMeasurements"], then that custom value will be written when the app is quit. You can call [[NSUserDefaults standardUserDefaults] synchronize] to force the values to be written Right Now -- very useful when sharing defaults between multiple applications.


Thanks on Cocoa pref theory. I had only dealt with Carbon apps via the CFPreferences APis, so I wasn't used to NOT seeing something…

mark

_______________________________________________
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


References: 
 >What writes out a pref file? (From: Mark Dawson <email@hidden>)
 >Re: What writes out a pref file? (From: Dan Yocom <email@hidden>)
 >Re: What writes out a pref file? (From: Bill Bumgarner <email@hidden>)

  • Prev by Date: Re: Is the Jaguar user base large enough to still
  • Next by Date: NSCoder encodeX:forKey vs encodeX:
  • Previous by thread: Re: What writes out a pref file?
  • Next by thread: Re: What writes out a pref file?
  • Index(es):
    • Date
    • Thread