FROM : Paul Collins
DATE : Sun Jul 02 20:25:01 2006
On Jul 2, 2006, at 9:17 AM, Benjamin Einstein wrote:
> We would really prefer to have global, "traveling" preferences
> that are embedded in the application bundle but can be modified
> locally (don't worry about rights, you must be a system admin and
> an application admin to make preferences changes). Is there a way
> to use NSUserDefaults to do this? Maybe CFPreferences?...
>
> There's one major catch: the application would have to be copied
> back when the user quits so other users get their updated
> preferences. Hmmmm. It would be okay unless the write failed.
A few concepts that may be applicable, or not...
NSUserDefaults has "defaults domains" that have a precedence order:
the existence of a particular preference in one domain overrides that
pref in any lower domains (when you are getting the value of the pref
in your code). The "Registration" domain is lowest. It is hard coded
in your app (I do it in my app delegate's init method). These are
never changed (unless you release a new version of the whole app),
but are overridden by prefs in any other domain, such as when the
user changes a pref locally and it is stored in the user's
Preferences folder by NSUserDefaults.
Again, what Bill said about the app bundle--think of the app bundle
as read-only.
CFPreferences is the Core Foundation API to the *same* preferences
system as NSUserDefaults, but has lower-level flexibility. In
particular, it lets you write prefs to different places, in what are
called "Preference Domains" - which are completely different than
("orthogonal to") NSUserDefaults "Defaults Domains"! "Preference
Domains" includes an "any host" concept that you might like, although
I am not sure what the boundaries of this are (local network??).
You can read up on all this in the ADC reference library in Xcode's
built-in documentation.
In case you haven't figured this out yet: Cocoa's NS classes are
always the first place to look, but for some low-level or unusual
functionality you may need to drop down into Core Foundation's CF
functions, or even go over to Carbon (for certain GUI or event
functions that haven't made it into Cocoa).
One other thought: can you just put these shared "preferences" into
the SQL database?
Welcome to Mac programming, and good luck!
--Paul Collins
** Gracion Software LLC http://www.gracion.com/ **
** Tel: +1 (541) 488-3488 iChat/AV/AIM: gracionsoft **
** DigiTunnel 1.4 PPTP/VPN client for OS X **
** Pronto Patent - search/download US patents fast **
** And check out: http://www.opendoor.com/doorstop/ **
DATE : Sun Jul 02 20:25:01 2006
On Jul 2, 2006, at 9:17 AM, Benjamin Einstein wrote:
> We would really prefer to have global, "traveling" preferences
> that are embedded in the application bundle but can be modified
> locally (don't worry about rights, you must be a system admin and
> an application admin to make preferences changes). Is there a way
> to use NSUserDefaults to do this? Maybe CFPreferences?...
>
> There's one major catch: the application would have to be copied
> back when the user quits so other users get their updated
> preferences. Hmmmm. It would be okay unless the write failed.
A few concepts that may be applicable, or not...
NSUserDefaults has "defaults domains" that have a precedence order:
the existence of a particular preference in one domain overrides that
pref in any lower domains (when you are getting the value of the pref
in your code). The "Registration" domain is lowest. It is hard coded
in your app (I do it in my app delegate's init method). These are
never changed (unless you release a new version of the whole app),
but are overridden by prefs in any other domain, such as when the
user changes a pref locally and it is stored in the user's
Preferences folder by NSUserDefaults.
Again, what Bill said about the app bundle--think of the app bundle
as read-only.
CFPreferences is the Core Foundation API to the *same* preferences
system as NSUserDefaults, but has lower-level flexibility. In
particular, it lets you write prefs to different places, in what are
called "Preference Domains" - which are completely different than
("orthogonal to") NSUserDefaults "Defaults Domains"! "Preference
Domains" includes an "any host" concept that you might like, although
I am not sure what the boundaries of this are (local network??).
You can read up on all this in the ADC reference library in Xcode's
built-in documentation.
In case you haven't figured this out yet: Cocoa's NS classes are
always the first place to look, but for some low-level or unusual
functionality you may need to drop down into Core Foundation's CF
functions, or even go over to Carbon (for certain GUI or event
functions that haven't made it into Cocoa).
One other thought: can you just put these shared "preferences" into
the SQL database?
Welcome to Mac programming, and good luck!
--Paul Collins
** Gracion Software LLC http://www.gracion.com/ **
** Tel: +1 (541) 488-3488 iChat/AV/AIM: gracionsoft **
** DigiTunnel 1.4 PPTP/VPN client for OS X **
** Pronto Patent - search/download US patents fast **
** And check out: http://www.opendoor.com/doorstop/ **
| Related mails | Author | Date |
|---|---|---|
| beinstein | Jun 20, 00:41 | |
| Yorh | Jun 20, 01:24 | |
| colela | Jun 20, 01:38 | |
| James Bucanek | Jun 20, 02:24 | |
| Paul Lynch | Jun 20, 18:39 | |
| Keary Suska | Jun 20, 18:44 | |
| Benjamin Einstein | Jun 22, 01:26 | |
| Ryan Britton | Jun 22, 01:39 | |
| Benjamin Einstein | Jun 22, 01:45 | |
| Shaun Wexler | Jun 22, 02:15 | |
| Benjamin Einstein | Jul 2, 18:17 | |
| Bill Bumgarner | Jul 2, 19:03 | |
| Paul Collins | Jul 2, 20:25 | |
| Benjamin Einstein | Jul 2, 20:33 |






Cocoa mail archive

