我正在使用 Core Data + iCloud 并获得不少 NSPersistentStoreCoordinatorStoresWillChangeNotifications,其中旧商店和新商店的 URL 是相同的。我只使用一台设备,并且在运行我的应用程序时会发生几次。
如果商店 URL 没有更改,并且设备是唯一一个将数据持久保存到商店的设备,为什么它会发出这些通知?当新旧 URL 相同时,是否可以忽略这些通知?
这是通知的 userInfo 字典的内容:
NSConcreteNotification 0x17a5f6b0 {name = NSPersistentStoreCoordinatorStoresWillChangeNotification; object = <NSPersistentStoreCoordinator: 0x167e05c0>; userInfo = {
NSPersistentStoreUbiquitousTransitionTypeKey = 4;
added = (
"<NSSQLCore: 0x1787bcf0> (URL: file:///var/mobile/Containers/Data/Application/8D9D2E83-DCD6-427B-BF5B-371D6DFD1999/Documents/CoreDataUbiquitySupport/mobile~38BB3D02-34D8-4E44-BCBE-B3ACC4FFA2DC/QatQiGameData3/8FD336B2-35D5-4D5F-8B06-415C7CA523CB/store/qatqi.sqlite)"
);
removed = (
"<NSSQLCore: 0x1787bcf0> (URL: file:///var/mobile/Containers/Data/Application/8D9D2E83-DCD6-427B-BF5B-371D6DFD1999/Documents/CoreDataUbiquitySupport/mobile~38BB3D02-34D8-4E44-BCBE-B3ACC4FFA2DC/QatQiGameData3/8FD336B2-35D5-4D5F-8B06-415C7CA523CB/store/qatqi.sqlite)"
);
}}