0

I had created a new modal version for Core data and assigned it to current modal version, so migration to it must be done(I hope), but now as I am doing old version of App to new version test, all the data is lost, what could be the possible problem?modal versions current version

I have found that the existing persistant store is not compatible and so it is deleting it and creating new one! So how do I prevent this?

  • Did you include `NSMigratePersistentStoresAutomaticallyOption` and `NSInferMappingModelAutomaticallyOption` with `true` values in the options dictionary you passed when adding the persistent store? – theMikeSwan Jun 18 '18 at 13:35
  • yes I did, well i have added new entity to the modal, so do I have to do anything more? – Nikhil Thite Jun 19 '18 at 08:49
  • You have to specifically tell Core Data that it should infer the mapping model between versions and that it should execute an automatic migration if possible when it finds an old store. You do that when you first create the Core Data stack. – theMikeSwan Jun 19 '18 at 15:29

0 Answers0