Actually I think I may have answered my own question: calling 
dequeueNotificationsMatching immediately before posting a new notification 
seems to do the trick. This seems like a reasonable and logical way of 
achieving what I want. Can anyone see any problem with doing that?

On 6 May 2015, at 11:54, Jonathan Taylor <jonathan.tay...@glasgow.ac.uk> wrote:

> I am trying to work out whether there are any rules that define which of 
> multiple NSNotifications combined using coalescing actually get through to 
> the receivers, and preferably a way of controlling that behaviour. This 
> becomes relevant if for example there is different UserInfo associated with 
> each object. I can’t find any specific statement about what the behaviour is 
> under these circumstances.
> 
> A concrete example: frames are received from a video camera, and a 
> notification (with coalescing) is sent when each one arrives (with a pointer 
> to the actual frame object in the user data of the NSNotification). Listeners 
> may wish to update their own displayed image if spare cycles are available. 
> However a quick experiment suggests that the EARLIEST-posted notification is 
> the one that survives coalescing. That means that receivers are acting on 
> stale information. No doubt there are some different circumstances where it 
> might make sense to keep the earliest-posted notification, but in this case 
> I’d definitely like the most-recently posted to make it through. 
> 
> I can think of several ways of achieving what I want with the help of 
> additional code, but is there any way I can get the NSNotification 
> infrastructure to behave the way I want (coalescing keeps the most 
> recently-posted notification and discards older ones)?
> 
> Thanks for any suggestions!
> Jonny.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to