user1372829
user1372829

Reputation: 1131

Is there a way to not need to regenerate the model with Core Data iOS

Say I generated an entity (User) in Model.xcdatamodeld with attributes firstName,lastName, dateCreated and so on. And then I generated a User.h, User.m

Then later on I realize I forgot to put an extra attribute into the User model.

Right now, everytime I have to delete User.h and User.m when I add a new attribute because somehow the compiler doesn't recognize the new attribute I put in.

Is there a way to note delete the generated files?

Upvotes: 0

Views: 169

Answers (1)

J2theC
J2theC

Reputation: 4452

If you are just adding a new attribute, just add a new property to the files you are generating, and add @dynamic propertyName on the implementation file.

On an unrelated note: make sure you are assigning class prefix to the classes you are generating as NSManagedObject subclasses from your model. "User" might be a system class, and you will get random runtime error messages and crashes.

Upvotes: 1

Related Questions