Thursday, May 30, 2019

xcode compile error after generating CoreDate NSManagedObject subclass using wizard

In xcode, after generating the subclass of NSManagedObject on a data model, the xcode will get some compile error due to duplicated class name.

This is because xcode will automatically generate a swift class for any CoreDate data model objects added in the project. So once you use the Xcode Editor->Create . NSManagedObject Subclass ... wizard to generate the swift class again, they will have the same class name and cause a compile error.

To avoid the error,
1. first select the xcdatamodeld item, and then select the data model entity.
2. open the data mobel inspector, and change teh Codegen to "Manual/None"
3. Clean and rebuild the project.

 

No comments:

Post a Comment