Saturday, March 10, 2012

How to generate NSManagedObject files for each entity from the model files using CoreData

1) Select the entity, e.g. Person
2) Show the data model inspector (Option-Command-3) and change the Class field to "Person" [Fig. 1]
3) With the entity still selected, select "New File->Core Data->NSManagedObject subclass" [Fig. 2]
4) Click Create button
5) Two files, Person.h and Person.m will be created automatically for you

Fig. 1

Fig. 2