【发布时间】:2016-04-08 11:05:27
【问题描述】:
我在使用核心数据和 iCloud 同步时遇到了一些有线行为。我将 iCloud 文档和 Cloudkit 功能添加到我的应用程序中,并订阅了以下三个通知:
NSPersistentStoreCoordinatorStoresWillChangeNotification
NSPersistentStoreCoordinatorStoresDidChangeNotification
NSPersistentStoreDidImportUbiquitousContentChangesNotification
我第一次运行应用程序时收到了这些通知:
Using local storage: 1
store will Change notification
store did Change notification
Using local storage: 0
但是,NSPersistentStoreDidImportUbiquitousContentChangesNotification 没有被触发,因为核心数据没有从我的 iCloud 帐户的无处不在的容器中下载数据。
但是,当我退出应用程序并重新启动它时,即使打开了飞行模式,我的所有数据也会立即加载。似乎数据在第一次启动时已下载并保存到 SQLite 存储,但没有触发通知,因此我的 UI 可以刷新。
以前有没有人经历过这种情况,你在那种情况下做了什么。
【问题讨论】: