在將MyClass
拖出框架之前,我可以將MyClass
的實例保存到Core Data中。導入爲框架後,NSKeyedUnarchiver decodeObjectForKey崩潰
這裏是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")
}
}
拉MyClass
出與的CocoaPods框架後,我開始得到這些崩潰:
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在我從手機中刪除應用程序並再次安裝後,一切正常......但是如果我需要推送,這不會起作用出更新?... – 7ball