Currently, my Iphone application is not released yet. When I worked with the simulator/device and I modify my application to add more cache into the encodeWithCode:
and initWithCoder:
. The problem is that when the application is loaded, I tried to use some of the encoded object which is not existing before. For example:
In the previous application version (e.g 1.2), I have this encode:
- (void)encodeWithCoder:(NSCoder*)coder {
[coder encodeObject:myArray forKey:NCITEMTABLE_ARCHIVE_HOME_ITEMS_KEY];
}
But with new version (e.g 1.3), I use this init:
- (id)initWithCoder:(NSCoder*)coder {
if (self = [super initWithCoder:coder]) {
myArray = [[coder decodeObjectForKey:NCITEMTABLE_ARCHIVE_HOME_ITEMS_KEY] retain];
myArray2 = [[coder decodeObjectForKey:NCITEMTABLE_ARCHIVE_HOME_ITEMS_2_KEY] retain];
}
return self;
}
and then the application will crash because it cannot find myArray2.
In the simulator or testing, I can just delete the old version and install from fresh. However, I am afraid that when it is released, I cannot tell my user to delete the old app and install the new fresh one. Have anyone experienced about this problem?