I am trying to archive my UIImageView which contains many CaLayers and Views.
I am successfully saved 'UIImageView' as Data through below code..
let data = try? NSKeyedArchiver.archivedData(withRootObject: self.backgroundIV!, requiringSecureCoding: false)
print(data)
When I try to un-archived UIImageView form Data via below code.
do {
let imageView: UIImageView = try NSKeyedUnarchiver.unarchivedObject(ofClass: UIImageView.self, from: data!)!
self.backgroundIV = imageView
print("Un Archived...")
} catch {
print(error)
}
}
I got this error..
Optional(922 bytes)
Error Domain=NSCocoaErrorDomain Code=4864 "This decoder will only decode classes that adopt NSSecureCoding. Class 'UIImageView' does not adopt it." UserInfo={NSDebugDescription=This decoder will only decode classes that adopt NSSecureCoding. Class 'UIImageView' does not adopt it.
}