Skip navigation.
 
mlRe: CFPreferences calls in Cocoa apps
FROM : Chris Parker
DATE : Thu Nov 18 18:27:55 2004

Hi Tom,

On Nov 18, 2004, at 9:18 AM, Thomas Davie wrote:

>  I'm writing what is at heart a cocoa application, but needs to make
> a few Core Foundation Preferences calls, specifically it needs to grab
> the preferences for another application.  I have been trying to use
> CFPreferencesCopyKeyList to grab the preferences, but it apparently
> always returns nil (at least within a cocoa app).  Considering what
> might be causing this, I decided to try synchronizing the preferences
> first using CFPreferencesAppSynchronize, this unfortunately causes a
> SIGABRT... Does anyone have any idea why this happens?


Without seeing a backtrace, no. :)

You should be fine calling CFPreferences API from within a Cocoa
application, and changes made in this way will be picked up by
NSUserDefaults.

If you're looking for a specific key within the other application's
preferences you should just be able to call

   somePlistRef = CFPreferencesCopyAppValue(theKey, theAppBundleID);

and be able to retrieve that key.

I believe CFPreferencesCopyKeyList should work, but if it doesn't
please file a bug.

.chris

--
Chris Parker
Cocoa Frameworks
Apple, Inc.

Related mailsAuthorDate
mlCFPreferences calls in Cocoa apps Thomas Davie Nov 18, 18:18
mlRe: CFPreferences calls in Cocoa apps Chris Parker Nov 18, 18:27
mlRe: CFPreferences calls in Cocoa apps The Karl Adam Nov 19, 02:44