我的應用程序使用包含在UIManagedDocument內的核心數據數據庫。當我試圖通過iCloud同步時,數據很少被刷新。我通過將下面的應用參數添加到我的方案中來打開無處不在的日誌。僅在應用程序啓動後立即調用iCloud NSPersistentStoreDidImportUbiquitousContentChangesNotification
-com.apple.coredata.ubiquity.logLevel 3
爭論日誌輸出顯示目的地設備識別它們的源設備上進行後不久,尚NSPersistentStoreDidImportUbiquitousContentChangesNotification
通知不會被觸發的變化。有時候,通知會在看到更新後觸發大量時間,但通常不會。
但是,當我重新啓動應用程序時(在日誌打印了一些關於更改的文本後的任何時候),將立即觸發NSPersistentStoreDidImportUbiquitousContentChangesNotification
通知,導致數據刷新。
注:我已訂閱通知。
[[NSNotificationCenter defaultCenter]addObserver:self
selector:@selector(updatedFromCloud:)
name: NSPersistentStoreDidImportUbiquitousContentChangesNotification
object:nil];
我有完全相同的問題,我傳遞持久性存儲協調器作爲對象參數。你找到解決方案嗎? – Ixx