NSManagedObject subclasses given project name
| Originator: | brice | ||
| Number: | rdar://14599760 | Date Originated: | 7/30/2013 |
| Status: | Open | Resolved: | |
| Product: | Xcode | Product Version: | 4.6.3 |
| Classification: | Other Bug | Reproducible: | Yes |
30-Jul-2013 10:09 PM Brice Wilson:
Summary:
After generating subclasses for Core Data entities, deleting the generated subclass files, clearing the "Class" property in the Data Model inspector, and re-generating Core Data subclasses, the class file names have the name of the project and not the name of the entities they should represent.
Steps to Reproduce:
1. New Project -> Master Detail iOS app -> check Use Core Data -> Name project "Temp1"
2. Add new file to project -> iOS Core Data -> NSManagedObject subclass
3. Select model named Temp1 -> Event entity -> Event.h and Event.m are added to project
4. Select Event.h and Event.m in Project Navigator -> Delete files -> move to trash
5. Select Temp1.xcdatamodeld in Project Navigator
6. Select "Event" entity
7. Open Data Model inspector
8. Delete text from the "Class" text box
9. Add new file to project -> iOS Core Data -> NSManagedObject subclass
10. Select model named Temp1 -> Event entity
11. Files named "Temp1.h" and "Temp1.m" are added to project. (THIS IS NOT CORRECT)
Expected Results:
The files added to the project in step 11 should have been named after the entity they were to represent. In this case that would have been "Event.h" and "Event.m".
Actual Results:
The files added to the project were named after the project instead of the entity.
Regression:
Notes:
I viewed the package contents of the Temp1.xcdatamodeld package and the Temp1.xcdatamodel package inside of it. I opened the "contents" file containing the XML representing the data model. It appears that after clearing the "Class" text box in the Data Model inspector the "representedClassName" attribute of the "entity" element was set to an empty string (""). Attempting to generate a new subclass at that point causes the new class file to be named after the project. If I edit the "contents" file to remove the "representedClassName" attribute from the entity element, then the subclass is added with the correct name.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!