Action Extension AND Sharing Core Data

空扰寡人 提交于 2019-12-02 04:25:11

The problem you describe happens because there's no notification to tell your app that there's new data in the persistent store file, so it just keeps showing the existing data. You need to handle this yourself.

A simple approach is to observe UIApplicationDidBecomeActiveNotification in your app. Any time you receive that, reload your data. You'll get any new entries created by the extension.

A more sophisticated approach is to use something like MMWormhole to notify the app of new content. Then it would only load new entries when they actually exist, instead of reloading every time it becomes active.

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