[NSKeyedUnarchiver decodeObjectForKey:] bug during call to [NSDocumentController openUntitledDocumentAndDisplay: error:]

  • Hello all,

      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 ?

                                                                                      TIA,

                                                                                                  Ewan
  • Ewan Delanoy <mailto:<delanoy...> 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
previous month september 2007 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Go to today