---
title: "CFUserNotificationReceiveResponse(_:_:_:)"
framework: Core Foundation
role: symbol
role_heading: Function
platforms: [macOS 10.0+]
path: "corefoundation/cfusernotificationreceiveresponse(_:_:_:)"
---

# CFUserNotificationReceiveResponse(_:_:_:)

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

## Declaration

```swift
func CFUserNotificationReceiveResponse(_ userNotification: CFUserNotification!, _ timeout: CFTimeInterval, _ responseFlags: UnsafeMutablePointer<CFOptionFlags>!) -> Int32
```

## Parameters

- `userNotification`: The user notification to use.
- `timeout`: The amount of time to wait for the user to respond to userNotification or for the notification to time out. If neither happens before timeout passes, this function returns a non-0 value. If timeout is 0, the function blocks until the user notification is dismissed.
- `responseFlags`: On return, contains flags identifying how the notification was dismissed, the state of any checkboxes, and the selected element of the pop-up menu. Bits 0-1 of the value hold an identifier for the button pressed by the user (see doc://com.apple.corefoundation/documentation/CoreFoundation/1534504-response-codes). Extract the identifier by performing a bitwise-AND operation with 0x3. Bits 8-15 of responseFlags hold the state of up to 8 checkboxes or radio buttons, if present. Extract the flags by performing bitwise-AND operations with the return value of doc://com.apple.corefoundation/documentation/CoreFoundation/CFUserNotificationCheckBoxChecked(_:). Bits 24-31 hold the index number of the element selected in a pop-up menu, if present. Extract the index by performing a 24-bit right shift: responseFlags >> 24.

## Return Value

Return Value 0 if the call successfully received a response; a non-0 value otherwise.

## Discussion

Discussion Use this function to poll a user notification for a user response. You can call it any number of times on the same user notification. To avoid polling and blocking your thread’s execution, you can create a run loop source for the user notification with CFUserNotificationCreateRunLoopSource(_:_:_:_:). You will then receive a callback when the dialog is dismissed.

## See Also

### CFUserNotification Miscellaneous Functions

- [CFUserNotificationCancel(_:)](corefoundation/cfusernotificationcancel(_:).md)
- [CFUserNotificationCheckBoxChecked(_:)](corefoundation/cfusernotificationcheckboxchecked(_:).md)
- [CFUserNotificationCreate(_:_:_:_:_:)](corefoundation/cfusernotificationcreate(_:_:_:_:_:).md)
- [CFUserNotificationCreateRunLoopSource(_:_:_:_:)](corefoundation/cfusernotificationcreaterunloopsource(_:_:_:_:).md)
- [CFUserNotificationDisplayAlert(_:_:_:_:_:_:_:_:_:_:_:)](corefoundation/cfusernotificationdisplayalert(_:_:_:_:_:_:_:_:_:_:_:).md)
- [CFUserNotificationDisplayNotice(_:_:_:_:_:_:_:_:)](corefoundation/cfusernotificationdisplaynotice(_:_:_:_:_:_:_:_:).md)
- [CFUserNotificationGetResponseDictionary(_:)](corefoundation/cfusernotificationgetresponsedictionary(_:).md)
- [CFUserNotificationGetResponseValue(_:_:_:)](corefoundation/cfusernotificationgetresponsevalue(_:_:_:).md)
- [CFUserNotificationGetTypeID()](corefoundation/cfusernotificationgettypeid().md)
- [CFUserNotificationPopUpSelection(_:)](corefoundation/cfusernotificationpopupselection(_:).md)
- [CFUserNotificationSecureTextField(_:)](corefoundation/cfusernotificationsecuretextfield(_:).md)
- [CFUserNotificationUpdate(_:_:_:_:)](corefoundation/cfusernotificationupdate(_:_:_:_:).md)
