1

I have some old archives that are basically stored preferences created with NSArchiver. I want to be able to decode them with NSKeyedUnarchiver since the NSArchiver/NSUnarchiver are deprecated in favor of their keyed counterparts.

Is there any way to make this work?

Trygve
  • 1,317
  • 10
  • 27
  • 1
    Please have a look at [Archives and Serializations Programming Guide](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Archiving/Archiving.html#//apple_ref/doc/uid/10000047i) – vadian Jan 29 '22 at 17:43

1 Answers1

1

You cannot decode an NSArchiver archive with NSKeyedUnarchiver. The NSArchiver format is deprecated, not just the classes. If you have data in the old format, you may have to use a deprecated class to decode it. The point is that you would then re-encode the data using NSKeyedArchiver (or one of the other options like Codable in Swift) and store it in a modern format.

Rob Napier
  • 286,113
  • 34
  • 456
  • 610