I have an Mac Application using a NSPersistentDocument. I want to get notified when Objects are deleted to save this information using Core Data. So I'm listening for NSManagedObjectContextObjectsDidChangeNotification. Often it is called instantly when objects are deleted, but sometimes it is only called after the persistent document is saved with all deleted objects not being notified before. Because I want to let the user directly export all existing objects (and not the deleted anymore) what to I have to do to become notified instantly to save the delete information or do I have to use it in another way?
Asked
Active
Viewed 1,603 times
1 Answers
9
NSManagedObjectContextObjectsDidChangeNotification is no longer issued as frequently or quickly on 10.7 as on 10.6. You can force Core Data to issue the notification (assuming there are changes) by calling -[NSManagedObjectContext processPendingChanges]
.

Aderstedt
- 6,301
- 5
- 28
- 44
-
thanks so far. I want to use this when data is deleted from a TableView that has a ArrayController as its source. Can I interrupt in another part to store information I need or to call processPendingChanges? – Tobe Oct 14 '11 at 11:58
-
You can observe the arrangedObjects on the NSArrayController, and perform processPendingChanges there. – Aderstedt Oct 16 '11 at 05:27
-
thanks, observing arrangedObjects and calling processPendingChanges sends the notification instantly. That's what I needed. – Tobe Oct 17 '11 at 11:41