Re: What writes out a pref file?
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