Sharing Data Between iOS and OS X

So far, we’ve discussed sharing data between iOS devices and linking our OS X application to iCloud. However, we haven’t discussed how to share data between OS X and iOS. Fortunately, there’s virtually no difference between OS X and iOS iCloud integration, though there are a couple of rules that we need to follow.

The Content Name Key Must Be the Same

The NSPersistentStoreUbiquitousContentNameKey is the unique value that iCloud uses to determine what data we’re accessing. If two devices use the same value and are signed by the same developer, they’ll be able to access the same data. If one or more devices and one or more OS X machines use the same key, they’ll share the same data. Throughout these examples, ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.