Question

I already have an app in the app store. I want to do an upgrade. My local data store has changed, with an extra table, and with a few fields added in the existing table. I want to retain the data in the old tables. How would I go about doing that? Could someone point me to tutorials that handle that kind of change?

Was it helpful?

Solution

Check out Apple's docs on migrating a core data instance. They make it super easy for 90% of the cases. The basic idea, is you break you xdatamodel into versions, so it has a path for migration

Here's a tutorial that might help you Core Data Migration

OTHER TIPS

Assuming you're using SQLite: Use a new database with a different name for your update. On startup, check for the table with the old name, copy the data you want, and delete it when you're done.

CoreData has it's own update data which may or may not work for you. You should look into how to change the data model.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top