【发布时间】:2020-06-18 01:08:26
【问题描述】:
我已将部分代码移至单独的框架中,该框架包含应用程序用来将数据持久保存到 CoreData 的模型。现在,当我尝试启动应用程序并尝试从 CoreData 恢复状态时,我收到以下错误。
2020-06-17 21:01:42.549851-0400 Project[17576:2986881] [error] fault: exception raised during multi-threaded fetch *** -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (Project.Track) for key (NS.objects) because no class named "Project.Track" was found; the class needs to be defined in source code or linked in from a library (ensure the class is part of the correct target). If the class was renamed, use setClassName:forClass: to add a class translation mapping to NSKeyedUnarchiver ({
"__NSCoderInternalErrorCode" = 4864;
})
在将代码拆分为单独的框架之前,它按预期工作。我尝试将框架导入到每个使用 CD 的类中,甚至尝试使用 Framework.Track 将其映射到类的新命名空间,但我仍然收到此错误。有没有人遇到过这种情况,如果有,您能否分享一些解决错误的见解?感谢您的帮助。
【问题讨论】:
标签: ios core-data nskeyedarchiver nskeyedunarchiver swift-framework