Reputation: 106
Using Xcode 6.2 and CoreData. I needed to rename a couple of entity names and recreate the NSManaged objects and noticed that the New Managed objects did not get named the same as the new entity names - the old name was used.
Here's some output from diff on the data model contents file:
- <entity name="SavedSignSets" representedClassName="SavedSignSets" syncable="YES">
+ <entity name="SavedSignSet" representedClassName="SavedSignSets" syncable="YES">
This a bug or am I doing something wrong?
UPDATE: Exact problem is this:
Upvotes: 2
Views: 2592
Reputation: 126
select the entity and check the entity inspector in the utilities view's data model inspector (the left left menu), each entity has a name field and a class field. When you change the name in the GUI you only change the class name. To correct the error you to change the name as well.
Upvotes: 11
Reputation: 513
The core data framework is a little finnicky in XCode. It has seemed to get confused in overwriting existing auto-generated files. I can't guarantee this is a fix, but you can try manually trashing your old Managed Object class file(s) from the XCode Navigation window (make sure you delete, and not just remove reference), and then creating the NSManagedObject subclass again under the guise of it being a new file.
In doing this, also manually check that any Relationship references in other files get updated with the new class name as well (sometimes they will load as the generic NSManagedObject class on one side of the relationship). It was taught to me as standard practice to trash the whole set of generated entity files and recreate them as a group.
(Also, I'm running XCode 6.1.1 so I'm not on your exact version)
Upvotes: 0