Re: CFPreferences and init: a possible reason?

2008-10-27 Thread Ken Thomases
On Oct 27, 2008, at 8:08 PM, Adam Penny wrote: I am able to write The contents of my one NSTextField to the plist with CFPreferencesSetAppValue, it's writing the two arrays that is the sticking point. When I try to do CFPreferencesSetAppValue for the array(s) I get an EXC_BAD_ACCESS raised

CFPreferences and init: a possible reason?

2008-10-27 Thread Adam Penny
Forgive me if I'm sounding like a broken record, but after a day experimenting with different approaches based on ideas that came up yesterday, I'm pretty confident that everything is sound as far as my controller class is concerned. I've been mulling this problem over and wanted to put my

Re: CFPreferences and init.

2008-10-26 Thread Kyle Sluder
On Sun, Oct 26, 2008 at 7:39 PM, Adam R. Maxwell <[EMAIL PROTECTED]> wrote: > > On Oct 26, 2008, at 2:47 PM, Kyle Sluder wrote: > >> And I've already noticed a memory management error in my own code; >> -setServers: leaks the old array. The first lines of the -setServers: >> method should look lik

Re: CFPreferences and init.

2008-10-26 Thread Adam Penny
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 th

Re: CFPreferences and init.

2008-10-26 Thread Adam R. Maxwell
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 f

Re: CFPreferences and init.

2008-10-26 Thread Adam R. Maxwell
On Oct 26, 2008, at 2:47 PM, Kyle Sluder wrote: And I've already noticed a memory management error in my own code; -setServers: leaks the old array. The first lines of the -setServers: method should look like this: -(void)setServers:(NSArray *)newServers { NSArray *oldServers = servers; ser

Re: CFPreferences and init.

2008-10-26 Thread Adam Penny
On Oct26, 2008, at 10:40 PM, Kyle Sluder wrote: On Sun, Oct 26, 2008 at 4:12 PM, Adam Penny <[EMAIL PROTECTED]> wrote: This is my code for the method in question and it's used for the NSTableView bindings: Your code is rather disorganized. Particularly, your use of else clauses is conf

Re: CFPreferences and init.

2008-10-26 Thread Kyle Sluder
And I've already noticed a memory management error in my own code; -setServers: leaks the old array. The first lines of the -setServers: method should look like this: -(void)setServers:(NSArray *)newServers { NSArray *oldServers = servers; servers = [[newServers copy] retain]; [oldServers r

Re: CFPreferences and init.

2008-10-26 Thread Kyle Sluder
On Sun, Oct 26, 2008 at 4:12 PM, Adam Penny <[EMAIL PROTECTED]> wrote: > This is my code for the method in question and it's used for the NSTableView > bindings: Your code is rather disorganized. Particularly, your use of else clauses is confusing and prone to introducing logic errors. > - (void

Re: CFPreferences and init.

2008-10-26 Thread Adam Penny
Hi again, I got the CFPreferences synchronize app working but, I'm now having issues with CFPreferencesSetApp value for an array. This is my code for the method in question and it's used for the NSTableView bindings: - (void) setServers:(NSMutableArray *)a; { //Method for adding

Re: CFPreferences and init.

2008-10-26 Thread Adam Penny
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

Re: CFPreferences and init.

2008-10-26 Thread Adam Penny
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= [[NSMutabl

Re: CFPreferences and init.

2008-10-26 Thread Jean-Daniel Dupas
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 serversFromPli

Re: CFPreferences and init.

2008-10-26 Thread Adam Penny
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"),

Re: CFPreferences and init.

2008-10-25 Thread Kyle Sluder
On Sat, Oct 25, 2008 at 6:11 PM, Adam Penny <[EMAIL PROTECTED]> wrote: > My question is how do I do the checks for the if clause? The documentation says that if the key doesn't exist, the function returns NULL. So then you just check to see if your servers variable is null. The documentation als

CFPreferences and init.

2008-10-25 Thread Adam Penny
Hi there, It's been a few days, actually been able to make some progress on my own for a change! I've set up my initWithBundle method like this: - (id)initWithBundle:(NSBundle *)bundle { if (![super initWithBundle:bundle]) return nil; appID = CFSTR("uk.co.pennynet.Wopol"); serve