Re: CFPreferences and init.
Re: CFPreferences and init.
- Subject: Re: CFPreferences and init.
- From: Adam Penny <email@hidden>
- Date: Sun, 26 Oct 2008 17:24:25 +0100
Hello again,
I was just trying to update the plist with
CFPreferencesAppSynchronize(appID), where
appID = CFSTR("uk.co.pennynet.Wopol") eventhoughthe
CFPreferencesSetAppValue is definitely working.
Currently my plist is in ~/Library/Preferences/
uk.co.pennynet.Wopol.plist and the control panel is in ~/Library/
PreferencePanes so I didn't think admin rights would be an issue, but
I'm starting to think I haven't grasped something (again). How do I do
this correctly?
Thanks,
Adam
On Oct26, 2008, at 1:14 PM, Adam Penny wrote:
On Oct26, 2008, at 1:12 PM, Jean-Daniel Dupas wrote:
Le 26 oct. 08 à 13:02, Adam Penny a écrit :
Hi there,
Thanks for your response Kyle.
Based on that I did this in my -(id)initWithBundle method and
tested it with and without a PList in the right place and it works:
servers= [[NSMutableArray alloc] init];
CFPropertyListRef
serversFromPlist=CFPreferencesCopyAppValue( CFSTR("servers"),
appID);
if (serversFromPlist &&
CFGetTypeID(serversFromPlist)==CFArrayGetTypeID())
{
[servers addObjectsFromArray: serversFromPlist];
// Get warning here: passing argument 1 of addObjectsFromArray
ignores qualifiers from target
}
printers= (NSMutableArray *)
CFPreferencesCopyAppValue( CFSTR("printers"), appID);
I think that the if clause protects the program from getting the
wrong pointer types, but I don't feel right about letting this
ride with a warning in it. Opinions?
So, tell the compiler that this is an NSArray:
[servers addObjectsFromArray: (NSArray *)serversFromPlist];
Ahhhhh, thank you!
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
_______________________________________________
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