Hi,
I'm having trouble loading my documents (and possibly saving them. Hard to tell).
My document class implements loadDataRepresentation like this: -
m_theModel = [NSUnarchiver unarchiveObjectWithData: data];
m_theModel is an instance of CModel, which is a class which derives from CItem and contains an NSMutableArray of CClass(es), which also derive from CItem. CItem has one data member - NSString m_strName;
CItem conforms to the NSCoding protocol and implements the following : -
- (id)initWithCoder

NSCoder *)coder
{
[self setName: [coder decodeObject]];
return self;
}
- (void)encodeWithCoder

NSCoder *)coder
{
[coder encodeObject: [self name]];
return;
}
CClass does not override these at all.
CModel has this: -
- (id)initWithCoder

NSCoder *)coder
{
// Let CItem decode the name
self = [super initWithCoder: coder];
// Decode our array of classes
[m_theClasses initWithCoder: coder];
return self;
}
- (void)encodeWithCoder

NSCoder *)coder
{
// Encode the name
[super encodeWithCoder: coder];
// Encode our classes
[coder encodeObject: [self classes]];
return;
}
When I open my document though I get the following error: -
2001-10-09 01:37:59.937 umlX[1273] *** NSUnarchiver: inconsistency between written and read data for object 0x225b630
Anyone know what I'm doing wrong?
brad