How can I act on Core Data iCloud sync notification when the app is in the background?

烂漫一生 提交于 2019-12-22 08:27:31

问题


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.

来源:https://stackoverflow.com/questions/35420546/how-can-i-act-on-core-data-icloud-sync-notification-when-the-app-is-in-the-backg

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!