Using NSArchiver with NSDocument
Using NSArchiver with NSDocument
- Subject: Using NSArchiver with NSDocument
- From: Weeks Family <email@hidden>
- Date: Mon, 15 Sep 2003 21:29:16 -0400
Howdy,
I am creating an application using the the Cocoa multi-document
architecture. When I save my document (subclass of NSDocument) the
encodeWithCoder method gets called twice. The saved document opens
okay. I am concerned that the saved file is unnecessarily large and
that I really do have a problem but just don't know it yet.
You can reproduce this by creating a new Cocoa document-based
application project in Project Builder V2.1. Add this empty method to
MyDocument:
- (void)encodeWithCoder:(NSCoder *)coder
{
}
Replace the return line in this method:
- (NSData *)dataRepresentationOfType:(NSString *)aType
{
return [NSArchiver archivedDataWithRootObject:self];
}
Set breakpoints at each method, and run. The dataRepresentationOfType
gets called once as expected. encodeWithCoder gets called twice.
Thanks in advance to whomever can shed some light on my mystery.
John
_______________________________________________
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.