Document Loading Problem
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 unarchiveObjectWith
Data: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.