0

My application has been published to the appstore. It uses Core Data in, what appears may be, an unorthodox fashion.

My xCode project contains two xcdatamodeld files: userData and statisticalData. When I create the ManagedObjectModel, I do so with mergeModelFromBundles. This takes all the models in my project and combines them to make one model. This allows me have a single persistent store and, I believe, simplified my code.

Now, I need to version my userData xcdatamodeld. Specifically, I need to add a string attribute to a one of my Entites.

To create the Model Version, I followed the steps outlined by Stian.

I've been cleaning the project and the build folder between builds, but I'm still getting an error:

NSCocoaErrorDomain Code=134130 "The operation couldn't be completed. (Cocoa error 134130.)" ... reason=Can't find model for source store

If I set the current version of the model to the original model, the app runs just fine and reads data created by the appstore version. But if I set the current version of the model to the updated version, it crashes.

Thanks for the help.

Community
  • 1
  • 1
Blamdarot
  • 3,317
  • 1
  • 18
  • 15

1 Answers1

0

If you successfully completed Stian's steps then you have added a new model version and activated it as the "current" version.

In my experience when I have more than one model version I have to switch from using "mom" to "momd".

Have you tried:

NSString* userDataPath = [[NSBundle mainBundle] pathForResource:@"User_data2" ofType:@"momd"];
radesix
  • 5,834
  • 5
  • 24
  • 39
  • Thanks. Turned out that I didn't need to change the managedObjectModel method at all: __managedObjectModel = [NSManagedObjectModel mergedModelFromBundles:nil]; – Blamdarot Sep 25 '12 at 04:19