• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSNotification coalescing - which one gets through?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >NSNotification coalescing - which one gets through? (From: Jonathan Taylor <email@hidden>)

  • Prev by Date: Re: iOS firing an event in the future when an app is in the background
  • Next by Date: static analyzers says I'm leaking, I _think_ I'm not
  • Previous by thread: Re: NSNotification coalescing - which one gets through?
  • Next by thread: Re: NSNotification coalescing - which one gets through?
  • Index(es):
    • Date
    • Thread