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

# CFUserNotification

```
class CFUserNotification
```

## Overview

A `CFUserNotification` object presents a simple dialog on the screen and optionally receives feedback from the user. The contents of the dialog can include a header, a message, an icon, text fields, a pop-up button, radio buttons or checkboxes, and up to three ordinary buttons. Use `CFUserNotification` in processes that do not otherwise have user interfaces, but may need occasional interaction with the user.

You create a user notification with the [`CFUserNotificationCreate(_:_:_:_:_:)`](/documentation/CoreFoundation/CFUserNotificationCreate(_:_:_:_:_:)) function. You pass in a dictionary whose keys describe the items to place into the dialog. (See [Dialog Description Keys](/documentation/CoreFoundation/dialog-description-keys) for the list of keys.) A set of flags passed to the function determines, among other things, whether secure text fields are used (such as for password fields), whether radio buttons or checkboxes are used, and which of these buttons are checked by default. You can also specify a timeout for the dialog, in which case the dialog cancels itself if the user does not respond in the allotted time period.

A user notification displays its dialog as soon as it is created. If any reply is required, it may be awaited in one of two ways: either synchronously, using [`CFUserNotificationReceiveResponse(_:_:_:)`](/documentation/CoreFoundation/CFUserNotificationReceiveResponse(_:_:_:)), or asynchronously, using a run loop source created with [`CFUserNotificationCreateRunLoopSource(_:_:_:_:)`](/documentation/CoreFoundation/CFUserNotificationCreateRunLoopSource(_:_:_:_:)). [`CFUserNotificationReceiveResponse(_:_:_:)`](/documentation/CoreFoundation/CFUserNotificationReceiveResponse(_:_:_:)) has a timeout parameter that determines how long it will block (zero meaning indefinitely) and it may be called as many times as necessary until a response arrives. If a user notification has not yet received a response, it may be updated with new information or it may be cancelled. User notifications may not be reused.

`CFUserNotification` provides two convenience functions, [`CFUserNotificationDisplayNotice(_:_:_:_:_:_:_:_:)`](/documentation/CoreFoundation/CFUserNotificationDisplayNotice(_:_:_:_:_:_:_:_:)) and [`CFUserNotificationDisplayAlert(_:_:_:_:_:_:_:_:_:_:_:)`](/documentation/CoreFoundation/CFUserNotificationDisplayAlert(_:_:_:_:_:_:_:_:_:_:_:)), to display very basic dialogs that either require no response from the user or require only a single button to be pressed, respectively.

## Topics

### CFUserNotification Miscellaneous Functions

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

Cancels a user notification dialog.

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

Returns a flag used to set or test a checkbox’s state.

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

Creates a CFUserNotification object and displays its notification dialog on screen.

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

Creates a run loop source for a user notification.

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

Displays a user notification dialog and waits for a user response.

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

Displays a user notification dialog that does not need a user response.

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

Returns the dictionary containing all the text field values from a dismissed notification dialog.

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

Extracts the values of the text fields from a dismissed notification dialog.

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

Returns the type identifier for the `CFUserNotification` opaque type.

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

Returns a flag used to set the selected element of a pop-up menu.

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

Waits for the user to respond to a notification or for the notification to time out.

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

Returns a flag used to set the secure state of a text field.

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

Updates a displayed user notification dialog with new user interface information.

### Callbacks

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

Callback invoked when an asynchronous user notification dialog is dismissed.

### Constants

[Alert Levels](/documentation/CoreFoundation/1534483-alert-levels)

Flags identifying the seriousness of a user notification.

[Response Codes](/documentation/CoreFoundation/1534504-response-codes)

Response codes identifying the button that was pressed to dismiss a notification dialog.

[Button Flags](/documentation/CoreFoundation/1534481-button-flags)

Flags that alter the display of buttons in a user notification dialog.

[Alert Levels](/documentation/CoreFoundation/1534483-alert-levels)

Flags identifying the seriousness of a user notification.

[Response Codes](/documentation/CoreFoundation/1534504-response-codes)

Response codes identifying the button that was pressed to dismiss a notification dialog.

[Button Flags](/documentation/CoreFoundation/1534481-button-flags)

Flags that alter the display of buttons in a user notification dialog.

[Dialog Description Keys](/documentation/CoreFoundation/dialog-description-keys)

Keys used in a user notification’s description dictionary, which describes the contents of the notification dialog to display.



---

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)