提问人:Ali Akbar 提问时间:1/19/2022 更新时间:1/19/2022 访问量:401
如何修复“此解码器将仅解码采用 NSSecureCoding 的类。类'UIImageView'不采用它。
How to fix "This decoder will only decode classes that adopt NSSecureCoding. Class 'UIImageView' does not adopt it."
问:
我正在尝试存档我的,其中包含许多和.UIImageView
CaLayers
Views
我通过以下代码成功将“UIImageView”保存为数据。
let data = try? NSKeyedArchiver.archivedData(withRootObject: self.backgroundIV!, requiringSecureCoding: false)
print(data)
当我尝试通过以下代码取消存档表单时。UIImageView
Data
do {
let imageView: UIImageView = try NSKeyedUnarchiver.unarchivedObject(ofClass: UIImageView.self, from: data!)!
self.backgroundIV = imageView
print("Un Archived...")
} catch {
print(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.
}
答: 暂无答案
评论