• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Document Loading Problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 unarchiveObjectWithData: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.

References: 
 >Document Loading Problem (From: Michael Briscoe <email@hidden>)

  • Prev by Date: Re: Problems with NSString: initWithCString
  • Next by Date: Re: [objC retain];
  • Previous by thread: Re: Document Loading Problem
  • Next by thread: Icon Badges
  • Index(es):
    • Date
    • Thread