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.
Post
Replies
Boosts
Views
Activity
Anybody?
I've fixed it. It's actually not caused by the code above but one extension for UIView that didn't layout after changing the constraints. Thanks anyway.
It's okay now. I've fixed it by changing the simulator from iPhone 12 to iPhone 14. Weird.
BTW, this is my Podfile, if it has anything to do with it:
use_frameworks!
platform :ios, '11.0'
target 'bimb-authenticate-ios' do
# Pods for bimb-authenticate-ios
pod 'Rudder', '~> 1.15.1'
pod 'RxSwift', '6.6.0'
pod 'RxCocoa', '6.6.0'
pod 'KeychainAccess'
pod 'Swinject'
pod 'SwiftOTP', :git => 'https://github.com/lachlanbell/SwiftOTP.git', :branch => 'swift-5.0-cryptoswift'
pod "RecaptchaEnterprise", "18.3.0"
pod 'RealmSwift', '~>10'
pod "RxRealm"
pod 'SwiftLint'
end
target 'bimb-authenticate-iosTests' do
inherit! :complete
# Pods for testing
pod 'RxBlocking', '6.6.0'
pod 'RxTest', '6.6.0'
end
target 'bimb-authenticate-iosUITests' do
inherit! :complete
# Pods for testing
pod 'RxBlocking', '6.6.0'
pod 'RxTest', '6.6.0'
end
# FORCE SET DEPLOYMENT TARGET TO 11.0 SINCE platform :ios, '11.0' DIDN'T SEEM TO DO ANYTHING!
post_install do |pi|
pi.pods_project.targets.each do |t|
t.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
end
end
end