找不到类,而是使用默认的NSManagedObject [英] Class not found, using default NSManagedObject instead
问题描述
IOS 8中的核心数据存在问题。每当我想使用 insertNewObjectForEntityForName
方法时,我都会得到
I have a problem with core data in IOS 8. Whenever I want to use the insertNewObjectForEntityForName
method, I get the
找不到类,而是使用默认的NSManagedObject。
Class not found, using default NSManagedObject instead.
错误消息。我使用objective-c,并且我没有使用IOS 7这个问题。也可能有任何问题,因为在我的工作区中有两个项目,一个包含与代码相关的核心数据,另一个包含UI。
Error message. I use objective-c, and I did not had this problem using IOS 7. Also could there be any problem because in my workspace there are two projects, one containing the core data relating code, and the other the UI.
推荐答案
该错误意味着您已在模型编辑器中为实体类型配置了自定义类名,但该类在以下位置不存在运行。 Core Data依赖于使用实体类型创建泛型 NSManagedObject
。
That error means that you've configured a custom class name for the entity type in the model editor, but that the class does not exist at run time. Core Data falls back on creating a generic NSManagedObject
using the entity type.
假设类文件实际存在于某处,问题是你没有在Xcode的app目标中包含该文件。由于Xcode支持多个目标,项目等,因此它不会自动包含每个构建中的每个源文件。将Core Data子类文件添加到应用程序目标,此错误应该消失。
Assuming that the class file actually exists somewhere, the problem is that you're not including that file in the app target in Xcode. Since Xcode supports multiple targets, projects, etc, it doesn't automatically include every source file in every build. Add the Core Data subclass file(s) to the app target and this error should go away.
这篇关于找不到类,而是使用默认的NSManagedObject的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!