Contents

AXObserverAddNotification(_:_:_:_:)

Registers the specified observer to receive notifications from the specified accessibility object.

Declaration

func AXObserverAddNotification(_ observer: AXObserver, _ element: AXUIElement, _ notification: CFString, _ refcon: UnsafeMutableRawPointer?) -> AXError

Parameters

  • observer:

    The observer object created from a call to 1460133 Axobservercreate.

  • element:

    The accessibility object for which to observe notifications.

  • notification:

    The name of the notification to observe.

  • refcon:

    Application-defined data passed to the callback when it is called.

Return Value

If unsuccessful, AXObserverAddNotification may return one of the following error codes, among others:

kAXErrorInvalidUIElementObserver

The observer is not a valid AXObserverRef type.

kAXErrorIllegalArgument

One or more of the arguments is an illegal value or the length of the notification name is greater than 1024.

kAXErrorNotificationUnsupported

The accessibility object does not support notifications (note that the system-wide accessibility object does not support notifications).

kAXErrorNotificationAlreadyRegistered

The notification has already been registered.

kAXErrorCannotComplete

The function cannot complete because messaging has failed in some way.

kAXErrorFailure

There is some sort of system memory failure.

See Also

Notification API