Re: [NSKeyedUnarchiver decodeObjectForKey:] bug during call to [NSDocumentController openUntitledDocumentAndDisplay: error:]
Re: [NSKeyedUnarchiver decodeObjectForKey:] bug during call to [NSDocumentController openUntitledDocumentAndDisplay: error:]
- Subject: Re: [NSKeyedUnarchiver decodeObjectForKey:] bug during call to [NSDocumentController openUntitledDocumentAndDisplay: error:]
- From: James Bucanek <email@hidden>
- Date: Sun, 9 Sep 2007 17:27:28 -0700
Ewan Delanoy <mailto:email@hidden> wrote
(Saturday, September 8, 2007 10:26 AM +0200):
I have a Cocoa project that runs fine on my PPC Mac OS X 10.4.10
machine, but
crashes on my father‘s Intel Mac OS X 10.4.6 machine. More details :
1) On the Intel I get the error message
2007-09-08 19:00:35.698 Schreiben[1599] *** -[NSKeyedUnarchiver
decodeObjectForKey:]: cannot decode object of class (GGValue)
and no error message at all on the PPC.
2) The best I achieved in bug tracking is that the crash occurs during
the computation of
[NSDocumentController openUntitledDocumentAndDisplay: error:]
3) GGValue is a class that existed in earlier forms of the
project, but not in the current version. In fact, if I use the
"Find in Project" functionality in Xcode and look for occurrences
of the string "GGValue", the answer is no match at all.
4) One would then expect that this problem stems from old data
that are misread by the new version of the app. However, this is
contradicted
by point 2), which shows that the crash occurs when a completely new,
untitled
document instance is created.
Any ideas ?
Despite your assertion in (4) I suspect that something,
somewhere, is reading old data that contains an archived
instance of GCValue. Computers tend to be rather literal, and
rarely make stuff up just to annoy programmers.
Probably the easiest way to find out what's going on is to
create a new GCValue class that does nothing but implement the
NSCoding protocol and has an empty implementation of
initWithCoder:. You can then set a breakpoint in [GCValue
initWithCoder:] and find the code that's trying to de-serialize it.
P.S. By the way, this is generally how I support archived
objects of obsolete classes. I create a placeholder class with
the same name as the legacy class. Its initWithCoder: method
essentially acts like a class cluster; it creates a new object
with the correct replacement class and returns that instead.
--
James Bucanek
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden