Question

Im using XCode 4 and working with CoreData. Now, how do I generate classes for entities? I used to do it in XCode 3 by clicking on a diagram entity, going to File->New and choosing NSManagedObject class.

For some reason i cant seem to find it in XCode 4, it's not showing up in the dialog...

Was it helpful?

Solution

You'll find in DP5 it is now a menu item. Finally!

OTHER TIPS

Add NSManagedObject Subclass

If you are new to Xcode (like me) some graphics to make it easier to explain. Just make sure that you select the entities that you want before you click on "Create NSManagedObject Subclasss"

I got it working by making the entity CLASS the same as the entity NAME, i.e. "Person" instead of "NSManagedObject". I also noticed that I have to invoke File > New File twice (!) The first time, the Managed Object Class template is not available, but the second time it is. No clue why. I'm running XCode 3.2.4.

While editing your xcdatamodel you need to select the entity and make sure the right hand Utilities pane is open. Select the Data Model Inspector (the tab on the right) and you can set the class of your entity to whatever you want.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top