Unarchiving Problems
Unarchiving Problems
- Subject: Unarchiving Problems
- From: Craig Bakalian <email@hidden>
- Date: Thu, 27 Mar 2003 05:28:06 -0500
Hi,
I am archiving a NSDocument Subclass like this -
- (NSData *)dataRepresentationOfType:(NSString *)aType
{
if([aType isEqualToString: @"EditTest"])
{
return [NSArchiver archivedDataWithRootObject: self];
}
return nil;
}
And I am unarchiving the beast like this -
- (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)aType
{
if([aType isEqualToString: @"EditTest"])
{
TestDocument *temp;
temp = [NSUnarchiver unarchiveObjectWithData: data];
if(temp)
{
return YES;
}
}
return NO;
}
While debugging I see the temp's objects, and _fileName _fileType is
marked as invalid? I can't figure this one out. I am also having
trouble reloading a NSMutableArray called questions. questions is an
array of objects that have the <NSCoding> protocol. This is my coder
code in my NSDocument subclass.
-(void)encodeWithCoder: (NSCoder *)coder
{
[coder encodeRect: frame];
[coder encodeObject: questions];
}
-(id)initWithCoder: (NSCoder *)coder
{
frame = [coder decodeRect];
questions = [[coder decodeObject]retain];
return self;
}
The debugger gets through all this, yet while following the stack of
NSDocument methods I get to readFile: ofType: and whammo i get this
sucker -
*** malloc[862]: error for object 0xf64c40: Incorrect checksum for
freed object - object was probably modified after being freed; break at
szone_error
TestFactory has exited due to signal 10 (SIGBUS).
Anybody?
Craig Bakalian
www.eThinkingCap.com
_______________________________________________
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.