我在使用 CoreData + iCloud 同步时遇到问题。
有时,通知 NSPersistentStoreDidImportUbiquitousContentChangesNotification 在 Inserted、Updated 和 Deleted 中返回一个空数组。
如果在发生更改时调用此通知,为什么返回一个空通知?
谢谢!!!
调用通知的代码:
- (void)persistentStoreDidChange:(NSNotification*)notification
{
DLog(@"Change Detected! Notification: %@", notification.description)
[__managedObjectContext performBlockAndWait:^(void)
{
[__managedObjectContext mergeChangesFromContextDidSaveNotification:notification];
for(id<CoreDataDelegate>delegate in _delegates)
{
if([delegate respondsToSelector:@selector(persistentStoreDidChange)])
[delegate persistentStoreDidChange];
}
}];
}