Class not found, using default NSManagedObject instead

前端 未结 6 739
既然无缘
既然无缘 2021-01-04 04:59

I have a problem with core data in IOS 8. Whenever I want to use the insertNewObjectForEntityForName method, I get the

Class not found,

6条回答
  •  孤城傲影
    2021-01-04 05:50

    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.

    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.

提交回复
热议问题