0

I went in to myapp.xcdatamodel and added an attribute to an entity. I then try to run my app and it dies at this line:

self.managedObjectContext = [delegate managedObjectContext];

do I need to do something special after saving the xcdatamodel file?

Arcadian
  • 4,312
  • 12
  • 64
  • 107

1 Answers1

1

When you're working with Core Data, any time you change something in your data model you need to use a migration to move your data. You can read a lot more about it in this SO post.

Another thing you can do (if you're willing to lose whatever data you have already entered) is to delete the app from the iPhone Simulator (or your iPhone) and then Build&Run again. This will recreate the database, but with your newer changes included.

Deleting and reinstalling is a quick fix, but if you're serious about using Core Data I'd suggest reading up on migrations -- they can be pretty easy once you get the basic concept.

Good luck!

Community
  • 1
  • 1
Neal L
  • 4,329
  • 8
  • 34
  • 39