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");
servers= (NSMutableArray *) CFPreferencesCopyAppValue( CFSTR("servers"), appID); printers= (NSMutableArray *) CFPreferencesCopyAppValue( CFSTR("printers"), appID);
        broadcastIP= @"255.255.255.255";
    return self;
}
Happily, it's getting my preferences as expected and the bindings are filling them in in my table.

However, I was a bit concerned because if it can't find the servers or printers keys in the plist then my NSMutableArray servers and printers won't be allocated and initialized and it'll knacker everything else up.

I was thinking of doing something like this:
servers=[[NSMutableArray alloc]init];
if ('servers' key is in the plist and it's an array)
 {
NSArray *serversInPlist=(NSArray *) CFPreferencesCopyAppValue( CFSTR("servers"), appID);
 [servers addObjectsFromArray: serversInPlist];
 [serversInPlist release];
 }

My question is how do I do the checks for the if clause?

Thanks,

Adam
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to