<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/CFNotificationCenter",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Core Foundation"
    ],
    "preciseIdentifier" : "c:@T@CFNotificationCenterRef"
  },
  "title" : "CFNotificationCenter"
}
-->

# CFNotificationCenter

```
class CFNotificationCenter
```

## Overview

A CFNotificationCenter object provides the means by which you can send a message, or notification, to any number of recipients, or observers, without having to know anything about the recipients. A notification message consists of a notification name (a CFString), a pointer value that identifies the object posting the notification, and an optional dictionary that contains additional information about the particular notification.

To register as an observer of a notification, you call [`CFNotificationCenterAddObserver(_:_:_:_:_:_:)`](/documentation/CoreFoundation/CFNotificationCenterAddObserver(_:_:_:_:_:_:)), providing an identifier for your observer, the callback function that should be called when the notification is posted, and the name of the notification and the object in which you are interested. The observer identifier is passed back to the callback function, along with the notification information. You can use the identifier to distinguish multiple observers using the same callback function. The identifier is also used to unregister the observer with [`CFNotificationCenterRemoveObserver(_:_:_:_:)`](/documentation/CoreFoundation/CFNotificationCenterRemoveObserver(_:_:_:_:)) and [`CFNotificationCenterRemoveEveryObserver(_:_:)`](/documentation/CoreFoundation/CFNotificationCenterRemoveEveryObserver(_:_:)).

To send a notification, you call [`CFNotificationCenterPostNotification(_:_:_:_:_:)`](/documentation/CoreFoundation/CFNotificationCenterPostNotification(_:_:_:_:_:)), passing in the notification information. The notification center then looks up all the observers that registered for this notification and sends the notification information to their callback functions.

There are three types of CFNotificationCenter—a distributed notification center, a local notification center, and a Darwin notification center—an application may have at most one of each type. The distributed notification is obtained with [`CFNotificationCenterGetDistributedCenter()`](/documentation/CoreFoundation/CFNotificationCenterGetDistributedCenter()). A distributed notification center delivers notifications between applications. In this case, the notification object must always be a CFString object and the notification dictionary must contain only property list values. The local and Darwin notification centers are available in macOS 10.4 and later, and obtained using [`CFNotificationCenterGetLocalCenter()`](/documentation/CoreFoundation/CFNotificationCenterGetLocalCenter()) and [`CFNotificationCenterGetDarwinNotifyCenter()`](/documentation/CoreFoundation/CFNotificationCenterGetDarwinNotifyCenter()) respectively.

Unlike some other Core Foundation opaque types with names similar to a Cocoa Foundation class (such as CFString and `NSString`), CFNotificationCenter objects cannot be cast (“toll-free bridged”) to <doc://com.apple.documentation/documentation/Foundation/NotificationCenter> objects or vice-versa.

## Topics

### Accessing a Notification Center

[`CFNotificationCenterGetDarwinNotifyCenter()`](/documentation/CoreFoundation/CFNotificationCenterGetDarwinNotifyCenter())

Returns the application’s Darwin notification center.

[`CFNotificationCenterGetDistributedCenter()`](/documentation/CoreFoundation/CFNotificationCenterGetDistributedCenter())

Returns the application’s distributed notification center.

[`CFNotificationCenterGetLocalCenter()`](/documentation/CoreFoundation/CFNotificationCenterGetLocalCenter())

Returns the application’s local notification center.

### Posting a Notification

[`CFNotificationCenterPostNotification(_:_:_:_:_:)`](/documentation/CoreFoundation/CFNotificationCenterPostNotification(_:_:_:_:_:))

Posts a notification for an object.

[`CFNotificationCenterPostNotificationWithOptions(_:_:_:_:_:)`](/documentation/CoreFoundation/CFNotificationCenterPostNotificationWithOptions(_:_:_:_:_:))

Posts a notification for an object using specified options.

### Adding and Removing Observers

[`CFNotificationCenterAddObserver(_:_:_:_:_:_:)`](/documentation/CoreFoundation/CFNotificationCenterAddObserver(_:_:_:_:_:_:))

Registers an observer to receive notifications.

[`CFNotificationCenterRemoveEveryObserver(_:_:)`](/documentation/CoreFoundation/CFNotificationCenterRemoveEveryObserver(_:_:))

Stops an observer from receiving any notifications from any object.

[`CFNotificationCenterRemoveObserver(_:_:_:_:)`](/documentation/CoreFoundation/CFNotificationCenterRemoveObserver(_:_:_:_:))

Stops an observer from receiving certain notifications.

### Getting the CFNotificationCenter Type ID

[`CFNotificationCenterGetTypeID()`](/documentation/CoreFoundation/CFNotificationCenterGetTypeID())

Returns the type identifier for the CFNotificationCenter opaque type.

### Callbacks

[`CFNotificationCallback`](/documentation/CoreFoundation/CFNotificationCallback)

Callback function invoked for each observer of a notification when the notification is posted.

### Constants

[`CFNotificationSuspensionBehavior`](/documentation/CoreFoundation/CFNotificationSuspensionBehavior)

Suspension flags that indicate how distributed notifications should be handled when the receiving application is in the background.

[Notification Posting Options](/documentation/CoreFoundation/1569610-notification-posting-options)

Possible options when posting notifications.

## See Also

  [Notification Programming Topics](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Notifications/Introduction/introNotifications.html#//apple_ref/doc/uid/10000043i)



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)