Re: Saving NSArray of custom objects
Re: Saving NSArray of custom objects
- Subject: Re: Saving NSArray of custom objects
- From: Mike Abdullah <email@hidden>
- Date: Tue, 14 Jul 2009 10:51:12 +0100
On 14 Jul 2009, at 01:22, DKJ wrote:
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;
}
Slightly separate to the question, have you actually declared that
your class conforms to the protocol, or just implemented the methods?
i.e. the header should be something like:
MyClass : NSObject <NSCoding>
_______________________________________________
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