【发布时间】:2012-09-24 00:29:36
【问题描述】:
我的应用使用包含在 UIManagedDocument 中的核心数据数据库。当我尝试通过 iCloud 同步时,数据很少被刷新。我已通过将以下 app 参数添加到我的方案中来打开普遍性日志。
-com.apple.coredata.ubiquity.logLevel 3
参数日志输出显示目标设备在源设备上进行更改后很快就会识别出更改,但不会触发NSPersistentStoreDidImportUbiquitousContentChangesNotification 通知。有时,通知会在看到更新后的很长一段时间内触发,但通常不会。
但是,当我重新启动应用程序时(在日志打印一些有关更改的文本后的任何时间), NSPersistentStoreDidImportUbiquitousContentChangesNotification 通知会立即触发,导致数据刷新。
注意:我已订阅通知。
[[NSNotificationCenter defaultCenter]addObserver:self
selector:@selector(updatedFromCloud:)
name: NSPersistentStoreDidImportUbiquitousContentChangesNotification
object:nil];
【问题讨论】:
-
我有完全相同的问题,我将持久存储协调器作为对象参数传递。你找到解决办法了吗?
标签: ios core-data icloud nsnotificationcenter uimanageddocument