Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
re: CFPreferencesSetValue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

re: CFPreferencesSetValue



On Mon, 31 May 2004 18:11:50 +0200, "Renee Dvir" <email@hidden>
wrote:
> I am trying to set preferences for all users of my application on the
> current host.
>
> When I call the function:

> CFPreferencesSetValue (cstr, &j, kCFPreferencesCurrentApplication,
> kCFPreferencesAnyUser,
>
> kCFPreferencesCurrentHost);
>
> where cstr is a CFStringRef and j is a long (both not NULL), the app
> crashes.
>
> Is there anything that needs to be called before this (such as creating the
> preferences file)?
>
> Am I calling it wrong?
>
> If there is another way to do this, that would also be good.

First off the second parameter needs to be a CFNumberRef, not a long.

Secondly, AnyUser prefs can only be set by an admin. If you want any user
prefs that can be set by anyone (like Hi-scores) then you should save them
into an XML file in /users/shared/.

I have sample code on my iDisk at:
<http://homepage.mac.com/geowar1/FileSharing1.html> in the "Public/Sample
Code" folder. It's called <CFPrefTopScores.sit>. It's about a page of code.
;-)

--
Enjoy,
George Warner,
Schizophrenic Optimization Scientists
Apple Developer Technical Support (DTS)
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.