Core Data and iCloud

So far, you know that iCloud keeps files in a ubiquity container in the cloud and that iOS devices with access to that ubiquity container pull down copies of that file and push back any edits. However, Core Data does something a little different.

Core Data is an interface to a single SQLite library file, so you might think we would store this file in the cloud. But this is a bad idea because a SQLite file can be very large and changing the data inside the file would require uploading the whole file to the cloud and downloading the whole thing to each device.

Instead, the SQLite file that Core Data talks to remains on the device’s local filesystem, and Core Data stores a transaction log file in the cloud. When a change is ...

Get iOS Programming: The Big Nerd Ranch Guide now with O’Reilly online learning.

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