【发布时间】:2017-07-24 21:07:51
【问题描述】:
在将MyClass 提取到框架之前,我可以将MyClass 的实例保存到Core Data 中就好了。
这里是MyClass的实现:
open class MyClass: NSObject, NSCoding {
required public init?(coder aDecoder: NSCoder) {
super.init()
stuffs = aDecoder.decodeObject(forKey: "stuff") as? [Stuff] ?? []
}
open func encode(with aCoder: NSCoder) {
aCoder.encode(stuffs, forKey: "stuffs")
}
}
在使用 CocoaPods 将 MyClass 拉出框架后,我开始遇到这些崩溃:
CoreData: error: exception handling request: <NSSQLFetchRequestContext: 0x1c019d4d0> , *** -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (MyClass) for key (NS.objects); the class may be defined in source code or a library that is not linked with userInfo of {
"__NSCoderInternalErrorCode" = 4864;
}
知道为什么吗?...
【问题讨论】:
-
编辑:所以在我从手机中删除应用程序并重新安装后,一切正常...但是如果我需要推出更新,这将不起作用?...o从手机中删除应用程序并重新安装后,一切正常...但是如果我需要推出更新,这将不起作用?...
标签: ios core-data cocoapods nscoding nscoder