• 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
Document Loading Problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Document Loading Problem


  • Subject: Document Loading Problem
  • From: Michael Briscoe <email@hidden>
  • Date: Wed, 27 Mar 2002 17:21:16 -0800

Hi List!

I'm working on an application that saves a document containing a view, with a background pict, and a pathname to an MP3 file. I think I've got the archiving process down, but when I unarchive the data is lost. Here's my code:

My controller is a NSDocument <NSCoding>:

- (NSData *)dataRepresentationOfType:(NSString *)aType
{
return [NSArchiver archivedDataWithRootObject:self];
}

- (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)aType
{
self = [[NSUnarchiver unarchiveObjectWithData:data] retain];

return YES;
}

- (void) encodeWithCoder:(NSCoder *)coder
{
[coder encodeObject:musicPath];
[coder encodeObject:dfxAnimateView];
return;
}

// initWithCoder
- (id) initWithCoder:(NSCoder *)coder
{
self = [super init];
musicPath = [[coder decodeObject] retain];
dfxAnimateView = [[coder decodeObject] retain];
return self;
}

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?

Thanks in advance!

Best Regards,
Michael Briscoe
SkyRocket Multimedia
http://www.digitalfireworks.com/SkyRocket/index.html
_______________________________________________
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.

  • Follow-Ups:
    • Re: Document Loading Problem
      • From: Ondra Cada <email@hidden>
    • Re: Document Loading Problem
      • From: jerome LAURENS <email@hidden>
  • Prev by Date: Re: Creating Directories
  • Next by Date: Re: Creating Directories
  • Previous by thread: Creating Directories Now Printing
  • Next by thread: Re: Document Loading Problem
  • Index(es):
    • Date
    • Thread