I am trying to recover an Mutable array of NSNumber objects. I'm getting an error indicating that, during unarchiving, NSObject does not recognize the selector which I guessed meant that either NSMutableArray or NSNumber did not conform to NSCoding protocol, but they both do. So I'm stumped about what the debugger (see below) is trying to tell me. What am I missing?
Here's the code.
Code:
//set up best times array
//the first four integers are unhinted best times, the last four are hinted times
NSData *dataRepresentingBestTimes = [defaults objectForKey:@"bestTimes"];
if (dataRepresentingBestTimes != nil)
{
NSLog(@"got data");
NSArray *timesArray = [NSKeyedUnarchiver unarchiveObjectWithData:dataRepresentingBestTimes];
bestTimes = [NSMutableArray arrayWithArray:timesArray];
NSLog(@"best times from data length = %d", [bestTimes count]);
} else {
bestTimes = [NSMutableArray arrayWithObjects: defaultTime,defaultTime, defaultTime, defaultTime,defaultTime,defaultTime, defaultTime, defaultTime,nil];
NSLog(@"had to build our own array, length is: %d", [bestTimes count]);
}
and here's the error from the debugger:
#0 0x0081f004 in ___TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION___
#1 0x97d98e3b in objc_exception_throw
#2 0x0084983b in -[NSObject doesNotRecognizeSelector:]
#3 0x007e0676 in ___forwarding___
#4 0x007bc6c2 in __forwarding_prep_0___
#5 0x0078c75c in CFDataGetBytePtr
#6 0x002929f4 in -[NSKeyedUnarchiver initForReadingWithData:]
#7 0x002f131c in +[NSKeyedUnarchiver unarchiveObjectWithData:]
Thanks for any pointers.