I've defined my own MyClass and made it conform to the NSCoding protocol by adding methods like this:

- (void)encodeWithCoder:(NSCoder *)encoder
{
    [encoder encodeInt:index forKey:@"index"];
}

- (id)initWithCoder:(NSCoder *)decoder
{
   self = [super init];
   index = [decoder decodeIntForKey:@"index"];
   return self;
}

I then put a bunch of these into an NSArray and try to save the array like this:

NSString *path = [NSHomeDirectory() stringByAppendingPathComponent:FILE_PATH];
   BOOL didIt = [theArray writeToFile:path atomically:NO];

But nothing is saved: didIt = 0.

I must be missing a step somewhere. I've been looking at "Archives and Serializations Programming Guide for Cocoa", and finding it rather bewildering. A nudge in the right direction would be much appreciated.

dkj
_______________________________________________

Cocoa-dev mailing list ([email protected])

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