I am trying to implement iCloud and I would need to notify the user about how does syncing with iCloud change the data. For example such notification would include that one more object has been added to the UITableView and can now be viewed.
Thanks
When iCloud posts NSPersistentStoreDidImportUbiquitousContentChangesNotification
, you know that changes have been received from the cloud. The userInfo
dictionary on this notification tells you what objects have changed. Look for values for the NSInsertedObjectsKey
, NSUpdatedObjectsKey
, and NSDeletedObjectsKey
keys. The values for those keys will list managed object IDs that identify the affected objects.
You don't get any notification of what attributes have changed on updated objects. If you have already loaded them, you could compare your loaded values with the new ones. Get the new values using NSManagedObjectContext
's existingObjectWithID:error:
method, and compare the resulting object to the one you already have. Do this before calling mergeChangesFromContextDidSaveNotification:
, so that you can still access the pre-merge state. If you don't already have it loaded, you can't get the attribute changes, because loading the object will show only the new values.