Frage

I have a project from Xcode 3 that I put through the conversion process to make it Xcode 4 compatible. Within this project, all of my NSManagedObject subclasses are inside a group with a ".xcdatamodeld" name.

If I update an entity in my data model with a new attribute, I want the methods for that attribute to be available in my entity's NSManagedObject subclass.

In Xcode 3, I would select the entities I wanted to regenerate and would select File -> New. This would replace the appropriate classes in the .xcdatamodeld group.

In Xcode 4, it's the same process, except the generated NSManagedObject subclasses will go anywhere except for that .xcdatamodeld group. Also, I can't remove any files from this group. There aren't any error messages or notifications telling why. It just doesn't do anything when I press the delete key.

The workaround I use is to go to Finder (or Terminal), remove the old classes, and then move the newly generated classes to the .xcdatamodeld directory. Is there a new paradigm that I'm missing or something? The workaround seems unnecessarily tedious.

War es hilfreich?

Lösung

It appears that the "xcdatamodeld group with NSManagedObject subclass files under it" paradigm has been removed as of Xcode 4. The way it works in Xcode 4 is for the data model to exist as a file node and for the NSManagedObject subclasses to live in a different group in the project altogether. What I did to finish the update to my Xcode 3 project was this:

  1. Remove the reference (only the reference) to the data model from the project.

  2. Go to Terminal and move all the NSManagedObject subclass files that were under the .xcdatamodeld directory to a new directory under my source directory. Finder seems to prevent access to the directory, but Terminal does not.

  3. Add the data model back to the project under the "Add existing files to project" menu item.

  4. Add the NSManagedObject subclass files back to the project.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top