FROM : Chris Parker
DATE : Thu Jan 30 23:25:50 2003
Hi Jim,
On Thursday, January 30, 2003, at 11:57 AM, Jim Correia wrote:
> I notice that if I put a preference in
> /Library/my.bundle.identifier.plist by hand, that it is picked up in
> the default search path for NSUserDefaults.
I'm hoping that's /Library/Preferences/my.bundle.identifier.plist - if
it's picking it up in /Library that's a bug, I think.
> Is there a way to use NSUserDefaults to put something there, or do I
> just need to make the CF call?
>
> CFPreferencesSetValue(CFSTR("Key"), CFSTR("Value"),
> kCFPreferencesCurrentApplication, kCFPreferencesAnyUser,
> kCFPreferencesCurrentHost);
Yes, but this will fail unless the user has permission to write into
/Library/Preferences (the average user doesn't). You'll have to use the
Authorization Services to be able to write this preference to disk.
> (I guess the same question applies to per host prefs...)
NSUserDefaults doesn't have the ability to write per-host preferences
at the moment, so using the CFPreferencesSetValue API is the correct
way to do this.
.chris
--
Chris Parker
Cocoa Frameworks Engineer
Apple Computer, Inc.
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
DATE : Thu Jan 30 23:25:50 2003
Hi Jim,
On Thursday, January 30, 2003, at 11:57 AM, Jim Correia wrote:
> I notice that if I put a preference in
> /Library/my.bundle.identifier.plist by hand, that it is picked up in
> the default search path for NSUserDefaults.
I'm hoping that's /Library/Preferences/my.bundle.identifier.plist - if
it's picking it up in /Library that's a bug, I think.
> Is there a way to use NSUserDefaults to put something there, or do I
> just need to make the CF call?
>
> CFPreferencesSetValue(CFSTR("Key"), CFSTR("Value"),
> kCFPreferencesCurrentApplication, kCFPreferencesAnyUser,
> kCFPreferencesCurrentHost);
Yes, but this will fail unless the user has permission to write into
/Library/Preferences (the average user doesn't). You'll have to use the
Authorization Services to be able to write this preference to disk.
> (I guess the same question applies to per host prefs...)
NSUserDefaults doesn't have the ability to write per-host preferences
at the moment, so using the CFPreferencesSetValue API is the correct
way to do this.
.chris
--
Chris Parker
Cocoa Frameworks Engineer
Apple Computer, Inc.
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
| Related mails | Author | Date |
|---|---|---|
| Jim Correia | Jan 30, 20:57 | |
| Chris Parker | Jan 30, 23:25 | |
| Jim Correia | Jan 30, 23:29 | |
| Chris Parker | Jan 30, 23:58 |






Cocoa mail archive

