Re: NSNotification coalescing - which one gets through?
Re: NSNotification coalescing - which one gets through?
- Subject: Re: NSNotification coalescing - which one gets through?
- From: Seth Willits <email@hidden>
- Date: Wed, 06 May 2015 11:00:37 -0700
On May 6, 2015, at 3:54 AM, Jonathan Taylor <email@hidden> 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.
My interpretation of the API is that user info should either be consistent or not used in coalescing scenarios, though the documentation never discusses this.
> 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?
Nope. Seems fine to me.
The other way to accomplish is this is to have the data stored outside of the notification and accessible to the receivers, and just let the notifications coalesce as normal. Instead of looking in userInfo, the receivers would go pull the data from the other source. But whether that's a better fit is questionable based on circumstances.
--
Seth Willits
--
Seth Willits
_______________________________________________
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