Re: Using NSArchiver with NSDocument - encode the data
Re: Using NSArchiver with NSDocument - encode the data
- Subject: Re: Using NSArchiver with NSDocument - encode the data
- From: John Weeks <email@hidden>
- Date: Tue, 16 Sep 2003 13:29:10 -0400
I left out some details. Thanks for pointing this out Scott.
My NSDocument subclass has several NSMutableArrays that hold instances of NSObject subclasses that represent the documents data. My application encodes and decodes these. I left them out to simplify the example.
Any other ideas?
Thanks.
From: Scott Anguish <email@hidden>
TO: Weeks Family <email@hidden>
CC:
Date: Tue Sep 16, 2003 01:24:52 AM EDT
Subject: Re: Using NSArchiver with NSDocument
normally you don't save the data by encoding the NSDocument object,
instead you archive the data itself
On Sep 15, 2003, at 9:29 PM, Weeks Family wrote:
>
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.
_______________________________________________
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.