NSKeyedUnarchiver.unarchivedObject()
‘unarchiveTopLevelObjectWithData’ was deprecated in iOS 12.0: Use unarchivedObject(ofClass:from:) instead
[general] *** -[NSKeyedUnarchiver validateAllowedClass:forKey:] allowed unarchiving safe plist type ''NSNumber' (0x1b9e88aa0)
[/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework]'
for key 'root', even though it was not explicitly included in the client allowed classes set:
'{(
"'NSData' (0x1b9e74490) [/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework]"
)}'
This will be disallowed in the future.
do {
guard let decodedData = try NSKeyedUnarchiver.unarchivedObject(ofClasses: [NSData.self, NSNumber.self], from: data) as? T else {
return .failure(.decode)
}
return .success(decodedData)
} catch {
return .failure(.decode)
}