NSManagedObjectContextObjectsDidChangeNotification is not always called instantly

I have a Mac application using NSPersistentDocument. I want to be notified when objects are deleted in order to save this information using Core Data. Therefore, I am listening to NSManagedObjectContextObjectsDidChangeNotification. Often it is called instantly when objects are deleted, but sometimes it is called only after saving a permanent document with all deleted objects that were not previously notified. Since I want the user to directly export all existing objects (and not deleted ones), what do I need to do to instantly receive notification of deletion of information, or do I need to use it differently?

+6
source share
1 answer

NSManagedObjectContextObjectsDidChangeNotification is no longer issued as often or quickly from 10.7 to 10.6. You can force Core Data to issue a notification (if there is a change) by calling -[NSManagedObjectContext processPendingChanges] .

+8
source

Source: https://habr.com/ru/post/899137/


All Articles