views:

50

answers:

1

So first, this question helped a lot with getting on the right track toward working core data versioning. So I added a new version for my model, and now I'm trying to get the automatic migration working, but I have a problem. I can't remember what my old version looked like! I'm trying to run the app on my phone, but I've been using the simulator for a while and made a few changes to the schema. The version on the phone is from quite a while ago. So each time I try to modify the old version to what I think is on the phone, but I still get the "can't find model for source store" error. I'm guessing it's because I got the old schema wrong.

Is there any way for me to figure out what the schema looks like on the phone? Barring that, how could I just wipe the sqlite store off the phone so I can start over from version 1?

A: 

The error message means it cannot find the .mom compiled model file for the existing store. Core Data is looking for the exact .mom version that configured the store. The .mom file tells tells Core Data how to map the serialized data in the file into objects. Without that model file, it does not know how to migrate the store to the new model because it doesn't know what data goes with each entity or entity property.

I've only seen this once and IIRC the cause was that the new .mom file had the exact same name and location as the old one. When the app was updated, the old .mom file was overwritten.

Try changing the name of the new model file and see if that helps. If not, we will probably need more detail about what you are doing.

TechZen