Core Data Codegen fail in Xcode 8

后端 未结 6 1540
萌比男神i
萌比男神i 2021-02-04 05:01

I have an iOS app containing a Core Data model with 6 entities. The entity Name is set up as follows:

Class Name: Name

6条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-04 05:45

    I got completely stuck with Problem 4 and none of the above worked for me. I use code generation. To resolve it I did the following steps:

    1. I opened the .xcdatamodel / content file in a text editor. (In Xcode right-click your .xcdatamodel and choose "Open in external editor"
    2. In the XML file I made sure that each entity has codeGenerationType="class"
    3. Close and reopened Xcode Cleared my derrived data folder
    4. It still refused to do the Code Generation, so I then generated each Entity manually (Editor, Create NSManageObject Subclasses, select all entities)
    5. Build the project. Now it also did the Code Generation and compiler errors appeared saying that the Entity filenames were used twice.
    6. Deleted the Manually created NSManagedObject subclasses created in step 5.
    7. After that the project built again successfully and the problem disappeared.

    PS: If you choose to Manually create your NSManageObject subclasses rather then using Code Generation, then make sure you remove codeGenerationType="class" from your entities in the XML file in step 2.

提交回复
热议问题