Saturday, May 23, 2015 [Tweets] [Favorites]

How Not to Crash #3: NSNotification

Brent Simmons:

I have one simple, hard-and-fast rule: NSNotifications are posted on the main thread only. No exceptions. If some code is running in another thread and it needs to post a notification, it does so on the main thread.

[…]

Your notification handlers should be written so that they can deal with getting called twice. And it should be impossible for a given object to register twice for the same notification. Both.

1 Comment

[…] Previously: NSNotificationCenter With Blocks Considered Harmful, How Not to Crash #3: NSNotification. […]

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment