I am trying to create two tables within the same sqlite database. Now, this two managedObjectModels don’t run in the same instance. Let me explain…I run the application once, and I create the managedObject in the persistent store, programmatically. Let say I have 5 attributes for that one. Then I run it again and I create a new managedObject in the persistent store, but this time I only use 3 attributes…how can I make this possible? Right now it crashes because the amount of attributes don’t match.
Regards and thanks!
The simplest answer is to not create your data model programmatically. It should be created at design-time and not modified. Instead, you should design your data model to be flexible enough to meet your needs. For instance, instead of creating one entity with a variable number of attributes, create two entities, one with a one-to-many relationship to the other, and store what information would have gone in your variable number of attributes there.