What are the conditions for NSManagedObjectContextObjectsDidChangeNotification to get posted?
What are the conditions for NSManagedObjectContextObjectsDidChangeNotification to get posted?
- Subject: What are the conditions for NSManagedObjectContextObjectsDidChangeNotification to get posted?
- From: Jim McGowan <email@hidden>
- Date: Wed, 15 Jan 2014 21:32:22 +0800
Hi,
I’ve noticed that NSManagedObjectContextObjectsDidChangeNotifications are not getting posted on every change to my ManagedObjectContext. The NSManagedObjectContext docs say it gets posted during -processPendingChanges, which is “invoked automatically at least once during the event loop (at the end of the loop)—it may be called more often than that if the framework needs to coalesce your changes before doing something else”. But this doesn’t seem to be the case and I can’t figure out what the conditions are for -processPendingChanges to get invoked.
For example, if I edit a ManagedObject’s string property through a bound NSTextField (with NSContinuouslyUpdatesValueBindingOption and NSValidatesImmediatelyBindingOption), sometimes the notification will be posted on every keystroke, other times it will get called for the first few keystrokes then no longer get called for any further keystrokes. But this is inconsistent, and I can't determine a pattern.
From Googling around I’ve seen a few mentions that on 10.7+ this notification gets called 'less frequently', but I can’t find any reference to this in the Release Notes or API docs. However, I did notice that Command-Tabbing away from the application after it has stopped posting the notification will trigger the notification to get posted, which might imply that the framework is trying to coalesce notifications, but I’m just guessing.
Can anyone shed any light on this behaviour?
Thanks,
Jim
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden