iCloud Notifications

Once the iCloud Store is ready, a notification called NSPersistentStoreCoordinatorStoresWillChangeNotification will be sent to indicate that the store is about to change. Once it is changed, another notification called NSPersistentStoreCoordinatorStoresDidChangeNotification will be sent. Additionally, when a store imports ubiquitous content, a notification called NSPersistentStoreDidImportUbiquitousContentChangesNotification is sent. All of these notifications must be observed in order to trigger an appropriate response. Listing 14.5 shows the code involved in a new method called listenForStoreChanges, which is used to configure the application to observe these critical notifications.

Listing 14.5 CoreDataHelper.m: listenForStoreChanges ...

Get Learning Core Data for iOS: A Hands-On Guide to Building Core Data Applications 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.