• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problem with -[NSKeyedArchiver setClassName:forClass:]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with -[NSKeyedArchiver setClassName:forClass:]


  • Subject: Re: Problem with -[NSKeyedArchiver setClassName:forClass:]
  • From: "Ben Kennedy" <email@hidden>
  • Date: Mon, 18 Oct 2004 15:55:05 -0400
  • Organization: Zygoat Creative Technical Services

On 18 10 2004 at 2:16 pm -0400, Ben Kennedy wrote:

>I also, however, I want to do the reverse; that is, archive
>ZDBOldPatternEvent as "ZDBPatternEvent" so that older versions of my app
>will read it correctly. So far as I can tell I should be able to do:
>
> [NSKeyedArchiver setClassName:@"ZDBPatternEvent" forClass:
>[ZDBOldPatternEvent class]];
>
>...however, my app crashes with EXC_BAD_ACCESS somewhere within
>encodeWithCoder: as soon as an instance of ZDBOldPatternEvent is being
>encoded.

Hello all,

Further experimentation leads me to believe that this is intended to
substitute names of pre-existent actual classes. Indeed, including the
following code inside ZDBOldPatternEvent.m (or anywhere else) alleviates
the crash:

@interface ZDBPatternEvent : NSObject
@end
@implementation ZDBPatternEvent
@end

This raises a couple of questions: a) is my rationale behind this
problem (of renaming a class but encoding it with a legacy name) ill-
advised, or is it reasonable? b) would others agree that it would be
worthwhile to file an enhancement request to obviate the above hackaround
and make the desired behaviour more straightforward?

-ben

--
Ben Kennedy, chief magician
zygoat creative technical services
613-228-3392 | 1-866-466-4628
http://www.zygoat.ca


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Problem with -[NSKeyedArchiver setClassName:forClass:] (From: "Ben Kennedy" <email@hidden>)

  • Prev by Date: Re: Crazy CFPreferences!
  • Next by Date: dictionaryWithContentsOfURL Questons
  • Previous by thread: Problem with -[NSKeyedArchiver setClassName:forClass:]
  • Next by thread: Weak linking constants
  • Index(es):
    • Date
    • Thread