微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

SecureCoding 与子类和 CoreData ni swift

如何解决SecureCoding 与子类和 CoreData ni swift

我想在 CoreData 字段中实现不同的可能值作为 Transformable 和子类。 Swift 似乎不喜欢我的实现:(超类)

public class ResponseItemValueDTODB: NSObject,NSSecureCoding {
  public static let supportsSecureCoding: Bool = true
  ...
}

子类:

class ResponseItemValueTextDTODB: ResponseItemValueDTODB {
  //public static var supportsSecureCoding: Bool  = true
  ...
}

现在错误Class 'xx.ResponseItemValueTextDTODB' has a superclass that supports secure coding,but 'xx.ResponseItemValueTextDTODB' overrides -initWithCoder: and does not override +supportsSecureCoding. The class must implement +supportsSecureCoding and return YES to verify that its implementation of -initWithCoder: is secure coding compliant.

如果我取消注释子类中的行,swift 编译器也不喜欢它,错误Cannot override with a stored property 'supportsSecureCoding' 在该行

我应该如何让 NSSecureCoding 开心?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。