swalkner
swalkner

Reputation: 17329

iOS: backup core data and restore with newer model version

How can I backup my core data objects created in version 1 and restore them in version 2? Simply copy the .sqlite-file won't work if the model changes... Is there a way to backup the file restore it and then start the migration?

Upvotes: 1

Views: 730

Answers (2)

swalkner
swalkner

Reputation: 17329

Thanks a lot for your suggestions!

Solved it with MagicalRecord the following way:

  1. [MagicalRecord cleanUp];
  2. copy .sqlite, .sqlite-shm, .sqlite-wal over to the new place
  3. [MagicalRecord setupCoreDataStackWithAutoMigratingSqliteStoreNamed:sqliteFileName];

finished - works perfect!

Upvotes: 1

Related Questions