Skip navigation.
 
mlNSKeyedArchiver and Forwards Compatibility Strategies
FROM : Colin Cornaby
DATE : Sat Apr 19 21:21:04 2008

I have an array of objects. The objects are all subclasses of one 
parent class. (For the sake of this email, I will say that the 
subclasses are all different kinds of graphics that can be displayed, 
and the superclass defines generalities that all graphics have in 
common.)

My concern here is that I may add new kinds of graphics in later 
versions of my software. I would like earlier versions of my software 
to read files from the later versions of my software, but obviously 
the earlier versions won't be able to work with data structures that 
they have no concept of.

Currently, I am thinking that I should probably set up the delegate of 
my NSKeyedUnarchiver to handle unknown classes, substitute in the 
superclass, and then afterwords remove any instances of the superclass 
from the array. (The issue here is that the superclass cannot actually 
be displayed by my software. While it defines general graphics 
attributes, it doesn't define include any code necessary to actually 
parse the graphical data attached to my class, and therefore probably 
should be ignored by my software.)

Is this the best way to deal with this situation? Will I receive 
notifications when the NSArray, which is a node of the root of the 
archive, fails to unarchive one of it's objects? Is there a way I can 
simply tell that NSArray not to unarchive that object as part of it's 
dataset, instead of cleaning up afterwards?

Thanks,
Colin

Related mailsAuthorDate
mlNSKeyedArchiver and Forwards Compatibility Strategies Colin Cornaby Apr 19, 21:21
mlRe: NSKeyedArchiver and Forwards Compatibility Strategies Graham Cox Apr 20, 06:29