iOS notifications are a simple and powerful way to send data in a loosely coupled way. That is, the sender of a notification doesn't have to care about who (if anyone) receives the notification, it just posts it out there to the rest of the app and it could be picked up by lots of things or nothing depending on your app's state.
The name of the notification for which to register the observer; that is, only notifications with this name are used to add the block to the operation queue. If you pass nil, the notification center doesn’t use a notification’s name to decide whether to add the block to the operation queue.
The object whose notifications the observer wants to receive; that is, only notifications sent by this sender are delivered to the observer. If you pass nil, the notification center doesn’t use a notification’s sender to decide whether to deliver it to the observer.
The operation queue to which block should be added. If you pass nil, the block is run synchronously on the posting thread.
The block to be executed when the notification is received. The block is copied by the notification center and (the copy) held until the observer registration is removed.
An NSNotificationCenter object (or simply, notification center) provides a mechanism for broadcasting information within a program. An NSNotificationCenter object is essentially a notification dispatch table.
For more info, check out the Apple Documentation here
Notifications are identified by global NSString objects whose names are composed in this way:
Name of associated class + Did | Will + UniquePartOfName + Notification
PS: It is also worth noting that the number of times an observer has been added has to be exactly the number of times the observer is removed. A rookie mistake is to add the observer in the viewWillAppear: of a UIViewController, but removing the observer in viewDidUnload:, will cause an uneven number of pushes and thus leaking the observer and the notification selector getting called in a superfluous manner.
Adding/Removing an Observer with a Block
Instead of adding an observer with a selector, a block can be used:
The observer can then be removed with:
Observing a Notification
Posting a Notification
Posting a Notification with Data
This modified text is an extract of the original Stack Overflow Documentation created by following contributors and released under CC BY-SA 3.0