NSNotificationCenter object (or simply, notification center) provides a mechanism for broadcasting information within a program. An
NSNotificationCenter object is essentially a notification dispatch table.
- iOS 2.0+
- macOS 10.0+
- tvOS 9.0+
- watchOS 2.0+
Objects register with a notification center to receive notifications (
NSNotification objects) using the
addObserverForName:object:queue:usingBlock: methods. Each invocation of this method specifies a set of notifications. Therefore, objects may register as observers of different notification sets by calling these methods several times.
Each running Cocoa program has a default notification center. You typically don’t create your own. An
NSNotificationCenter object can deliver notifications only within a single program. If you want to post a notification to other processes or receive notifications from other processes, use an instance of