Re: CFPreferences and init.
Re: CFPreferences and init.
- Subject: Re: CFPreferences and init.
- From: Adam Penny <email@hidden>
- Date: Mon, 27 Oct 2008 01:43:00 +0100
On Oct27, 2008, at 12:46 AM, Adam R. Maxwell wrote:
On Oct 26, 2008, at 4:23 PM, Adam Penny wrote:
That's the binary plist representation. This will be transparent to
well-behaved applications. Naughty ones will try to read the raw
XML
plist representation and fail, but ones that use the plist
serialization API won't know the difference.
So from that, do I gather that the binary is the preferred standard
for plists?
Presently it appears to be, but Apple has changed that in the past,
so don't rely on it...
I'll probably show myself up to be barmy with my next revelation,
but this preference panel actually started off to set the
preferences for an automatically triggered Ruby command line script
that I wrote for waking up hosts that share printers automatically
when a print job is sent to the printer in question. I built that
to read its preferences from an apple XML type plist file. At a
future date, I'd like to rewrite that as an objective-c command
line utility, but for the moment Is there any way I can coerce
CFPreferences to synchronize as XML rather than binary? As the
script will be the only thing referring to the plist for the moment
I'm not too worried about other 'naughty' applications! :-)
A couple of suggestions that you may not have considered:
1) if you use /usr/bin/defaults in your Ruby script, you can read/
write the preference file and ignore the plist format.
Wow, I've just had a quick glance at this and I really wish I'd come
across this before. This looks like I could do the Ruby plist reading
10 times more easily than the way I'm doing it now. Thank you for the
suggestion.
2) avoid the preference system entirely by writing your plist
somewhere else, such as the Library/Application Support hierarchy.
You can then read/write the plist using NSPropertyListSerialization,
which allows you to specify XML format.
Your first revelation has persuaded me to keep going with
CFPreferences and as from what I've read and what Kyle and yourself
have said my error probably means that I'm creating a zombie somewhere
in the CFPreferencesSetAppValue for the array. Time to read that
documents on accessor methods.
Thank you again.
Adam
hth,
Adam
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden