My iOS app makes use of two Core Data (.sqlite) stores: one is a read-only store in the app bundle (call it the “Resource” store), and the other is a read-write store in the app’s default directory for user-created data (the “User” store).
There is a single Core Data Model (.momd) defining all of the entities in both stores. The model has Configurations specifying which store each entity is associated with.
At runtime, there is no code to explicitly move the Resource store anywhere; the app just loads the Resource store directly from the app bundle and that seems to work just fine. The app loads the User store from defaultDirectoryURL() and that works, also.
Given this setup, I would expect that I could freely modify the guts of any entity associated with the Resource store. But, in testing I’ve found that if I change the data type of an attribute in a Resource entity (for example, from String to Date) then I get a migration error at runtime. Oddly though, the app doesn’t crash — it complains about a missing mapping model, but then it seems to work with the changed Resource entity anyway.
What is the reason for the migration error and should I be concerned by it if the app seems to work anyway?
I tried changing the data type of an attribute in a Core Data entity associated with a read-only persistent store, expecting no problem. What actually resulted was a migration error at runtime but the app continued to work.