Migrating an Existing Application

Because Core Data keeps track of changes via transaction logs, it’s impossible to just “turn on” iCloud in an existing application and expect all the data to get pushed into the cloud. A few other steps are necessary.

The first question when adding iCloud to an existing iOS application is whether the migration is necessary. There are two key criteria for answering this question:

  • Is there any existing data to migrate?
  • Has the migration already been performed?

Both of these questions can be answered easily if we do a simple filename change. For example, if our application has always used a SQLite file named PPRecipes.sqlite, then when we want to add iCloud integration to our application, we should start using a filename ...

Get Core Data in Swift now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.