I've fixed this by using a custom NSKeyedUnarchiver based on this SO answer: https://stackoverflow.com/a/46832840/4124849. Here's the class:
class KeyedUnarchiver: NSKeyedUnarchiver {
override open func `class`(forClassName codedName: String) -> Swift.AnyClass? {
let legacyModuleString = "cdx_ios."
if let range = codedName.range(of: legacyModuleString), range.lowerBound.encodedOffset == 0 {
return NSClassFromString(codedName.replacingOccurrences(of: legacyModuleString, with: ""))
}
return NSClassFromString(codedName)
}
}
So I guess the problem is that my object has nested object so NSKeyedUnarchiver.setClass(_:forClassName:) doesn't work.
Topic:
App & System Services
SubTopic:
General
Tags: