Confused between NSCoder and NSArchiver
Confused between NSCoder and NSArchiver
- Subject: Confused between NSCoder and NSArchiver
- From: Mark Ogilvie <email@hidden>
- Date: Sat, 15 Mar 2003 20:37:33 -0500
I've been working with the Oreily book Learing Cocoa with Objective C
(Second edition) and I'm stuck on apoint. In their example where they
archive an object they use this statement
[NSArchiver archiveRootObject:items toFile:[sheet filename]];
items being an array. But even though they have an encodeWithCoder
routine else where in the program
-(void)encodeWithCoder:(NSCoder *)coder
{
[coder encodeObject:[self name]];
[coder encodeObject:[self price]];
}
(name and price being part of the array.)
I'm not sure when or how it is called. I know I'm missing something
very basic here. I thought it might be because NSArchiver inherits
from NSCoder and uses its methods, but don't those methods have to be
called explicitly?
Thanks Mark
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.