Hi, in my previous macOS app I used to archive a dictionary to a preference file using
[NSArchiver archivedDataWithRootObject:dictionary];
and to unarchive it using
[NSUnarchiver unarchiveObjectWithData:dataFromDisk];
Now I would like to replace the 2 deprecated methods with
NSError *error;
NSSet *classSet = [NSSet setWithObjects:[NSDictionary class], [NSArray class], [NSString class], [NSNumber class], [NSData class], nil];
NSDictionary *dictionary = [NSKeyedUnarchiver unarchivedObjectOfClasses:classSet fromData:dataFromDisk error:&error];
But I get a nil dictionary and the error 4864: non-keyed archive cannot be decoded by NSKeyedUnarchiver. So I guess I should first keep on unarchiving the preferences dataFromDisk using the old deprecated method
[NSUnarchiver unarchiveObjectWithData:dataFromDisk];
Then I could use the new NSKeyedArchiver and NSKeyedUnarchiver methods for the upcoming release.
But, if this deprecated method
[NSUnarchiver unarchiveObjectWithData:dataFromDisk];
fails to unarchive the old data (and on some machines now it fails), how could I use the new methods? Should I consider my old preference file gone?
Is a way to force the new NSKeyedUnarchiver method to unarchive data previously archived with NSArchiver ?