NSPsistentStore Master Data

I am developing an application that runs in stages. For each sprint, database changes occur, so the main data migration was implemented. So far, we have released 3 stages. Whenever a sequential gradation is performed, the application works fine. But whenever I try to switch from version 1 to version 3, the error "inability to add persistent storage" occurs. Can someone help me with a problem?

+7
ios7 core-data core-data-migration nspersistentstore
source share
2 answers

My problem is that I am trying to change my attribute data type during an easy migration with automatic migration, since the automatic transfer of data with a light core does not support changing the data type. I solved this problem by resetting the data type to an older one.

+1
source share

Migration of master data has no concept of versions, as you would expect from them. As for the main data, there are only two versions: the version of NSPersistentStore and the version that you are currently using.

To use easy migration, you must test each version of your store and make sure that it is directly migrated to the current version. If this is not the case, you cannot use light migration for this particular use case, and you either need to develop a migration model or come up with another solution.

Personally, on iOS, I avoid heavy migration, as it is very expensive in terms of memory and time. If I cannot use easy migration, I will most often study export / import solutions (for example, export to JSON and import into a new model) or watch the data update from the server.

+5
source share

All Articles