Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > NSArchiver etc.

NSArchiver etc.
Thread Tools
Fresh-Faced Recruit
Join Date: Oct 2001
Status: Offline
Reply With Quote
Oct 8, 2001, 08:04 PM
 
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
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:19 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2