<!--
{
  "availability" : [
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/CFUserNotificationCreate(_:_:_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Foundation"
    ],
    "preciseIdentifier" : "c:@F@CFUserNotificationCreate"
  },
  "title" : "CFUserNotificationCreate(_:_:_:_:_:)"
}
-->

# CFUserNotificationCreate(_:_:_:_:_:)

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

```
func CFUserNotificationCreate(_ allocator: CFAllocator!, _ timeout: CFTimeInterval, _ flags: CFOptionFlags, _ error: UnsafeMutablePointer<Int32>!, _ dictionary: CFDictionary!) -> CFUserNotification!
```

## Parameters

`allocator`

The allocator to use to allocate memory for the new object. Pass `NULL` or kCFAllocatorDefault to use the current default allocator.

`timeout`

The time to wait before the notification dialog dismisses itself if the user does not respond. If `0`, the notification never times out.

`flags`

A set of flags describing the type of notification to display. These flags specify an alert level for the notification (see [Alert Levels](/documentation/CoreFoundation/1534483-alert-levels)), determine whether radio buttons or checkboxes are to be used (see [Button Flags](/documentation/CoreFoundation/1534481-button-flags)), specify which, if any, of these buttons are checked by default (see [`CFUserNotificationCheckBoxChecked(_:)`](/documentation/CoreFoundation/CFUserNotificationCheckBoxChecked(_:))), specify whether any of the text fields are to be secure text fields (see [`CFUserNotificationSecureTextField(_:)`](/documentation/CoreFoundation/CFUserNotificationSecureTextField(_:))), and determine which element of a pop-up menu, if present, should be selected by default (see [`CFUserNotificationPopUpSelection(_:)`](/documentation/CoreFoundation/CFUserNotificationPopUpSelection(_:))). Combine these flags together by performing a bitwise-OR operation with all the individual flags.

`error`

On return contains an integer error code. If `0`, the user notification was successfully created and displayed.

`dictionary`

A description of the elements to display in the notification dialog. The possible keys are listed in [Dialog Description Keys](/documentation/CoreFoundation/dialog-description-keys). The dictionary must contain a value for the key [`kCFUserNotificationAlertHeaderKey`](/documentation/CoreFoundation/kCFUserNotificationAlertHeaderKey), but the other keys are optional.

## Return Value

The new CFUserNotification object. Ownership follows the [The Create Rule](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html#//apple_ref/doc/uid/20001148-103029).

## Discussion

---

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)