Re: Document Loading Problem
Re: Document Loading Problem
- Subject: Re: Document Loading Problem
- From: Ondra Cada <email@hidden>
- Date: Thu, 28 Mar 2002 12:35:59 +0100
On Thursday, March 28, 2002, at 02:21 , Michael Briscoe wrote:
I inserted NSLogs(...) in the loadDataRepresentation and it seems to work,
but by the time windowControllerDidLoadNib fires, self seems to be
reinitialized.
What am I doing wrong here?
Reinitializing self, of course!
Anyone please correct me if I am wrong, but so far as I understand the
document architecture, you are *NOT* supposed to change the document. In
other words, the pattern you want is rather
- (NSData *)dataRepresentationOfType:(NSString *)aType
{
return [NSArchiver
archivedDataWithRootObject:anAppropriateOutletOfSelf];
}
- (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)aType
{
return (anAppropriateOutletOfSelf=[[NSUnarchiver
unarchiveObjectWith
Data:data] retain])!=nil);
}
or alike.
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
2K Development: email@hidden
http://www.2kdevelopment.cz
private email@hidden
http://www.ocs.cz/oc
_______________________________________________
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.