views:

725

answers:

5

I created a .xcdatamodel Managed Object Model file in Xcode. I selected that file in Groups & Files. Then I go to File > New... > and nowhere in the iPhone Templates / Cocoa Touch Class templates I see the "Managed Object Class" file template.

Does anyone know what can be wrong?

+8  A: 

I usually need to also select the entities for which I want to generate the class files.

gerry3
GREAT! That was exactly the solution. Thanks!
openfrog
It seems like this should be accessible via a right click or something.
Peter DeWeese
A: 

I don't see this either. I click on the entity in my .xcdatamodel and choose File>File New, but there is no Managed Object Class, only Objective-C, Objective-c test case class, and UIVewController subclass.

What am I missing?

Thanks in advance

Shawn
+2  A: 

If you are wanting to subclass NSManagedObject then I would highly recommend talking a look at mogenerator (github). It will autogenerate the subclasses for you AND keep them in sync as you update your model. It also has the concept of machine classes vs. human classes so that you can add convenience methods, etc. without your code being stepped on each time you update your model.

Marcus S. Zarra
mogenerator looks awesome. I had heard of it, but hadn't checked it out until now. Thanks!
gerry3
+1  A: 

I've seen this problem before as well. Solution for me was to click on a non-data model file (in Groups & Files) and then click back on the versioned data model file (and entity within it) and then try File -> New File. Alternatively, restarting xcode, selecting the data model file (and entity within it) and then trying File -> New File also worked for me.

Tofrizer
Ah-ha! I knew I was doing it right!
JoBu1324
A: 

Click On the top left where it says "Simulator 3.1.2 | debug". Change it to "IPHONE Device 3.1.2 (BASE SDK)... voila. (SAMS iphone in 24hrs?? lots of typos and incomplete procedures!)

JohnR