How can I act on Core Data iCloud sync notificatio

2019-07-02 22:13发布

问题:

I have an iOS app that uses Core Data with iCloud sync. The app is working perfectly and syncing across multiple devices. As part of my implementation my app is registered for the:

NSPersistentStoreCoordinatorStoresDidChangeNotification

This notification works perfectly with the app in the foreground, but what I would like to do is fire a local notification to let the user know that the iCloud data in the app has changed, whenever the app is in the background and a sync notification comes in.

I was under the impression that iCloud Core Data syncing continued in the background, but I am having trouble figuring this one out.

The code to fire a local notification is located in the function that is run when the above notification comes in, but it only works when the app is in the foreground.