Using devicectl to observe Darwin Notifications

Hello, I'm trying to use devicectl to observe Darwin Notifications on my iPhone.

Instructions:

OVERVIEW: Observe a Darwin notification on a device.

Note that this command will wait for 300 seconds by default before exiting. You
can override this by providing a different --timeout value.

USAGE: devicectl device notification observe --device <uuid|ecid|udid|name> --name <name> ... [--verbose] [--quiet] [--timeout <seconds>] [--json-output <path>] [--log-output <path>]

DEVICE OPTIONS:
  -d, --device <uuid|ecid|udid|name>
                          The identifier, ECID, UDID, or name of the device.

COMMAND OPTIONS:
  --name <name>           The name of the Darwin notification.
        This can be passed multiple times to observe multiple Darwin
        notifications.

OUTPUT OPTIONS:
  -v, --verbose           If given, provide more logging output than normal.
  -q, --quiet             If given, output will include only errors.
  -t, --timeout <seconds> The overall command timeout in seconds. If this limit
                          is exceeded the command is abandoned as a failure.
  -j, --json-output <path>
                          An optional path to write a JSON file with command
                          results.
        Note: JSON output to a user-provided file on disk is the ONLY supported
        interface for scripts/programs to consume command output.
  -l, --log-output <path> An optional path to write all logging otherwise
                          passed to stdout/stderr.

OPTIONS:
  --version               Show the version.
  -h, --help              Show help information.

Executed command: xcrun devicectl device notification observe --device *** --name com.example.Notification

Result: Darwin notification observation started. 300.0 seconds remaining:

On iOS, I'm posting a Darwin notification using:

CFNotificationCenterPostNotification(center, CFNotificationName("com.example.Notification" as CFString), nil, nil, true)

My CFNotificationCenterAddObserver on iOS does receive this notification. But the devicectl does not. Also no results when I remove the observer on iOS.

How can I send a notification in such a way that it is picked up by the devicectl observer?

I'm trying to use devicectl to observe Darwin Notifications on my iPhone.

Why? What do you hope to gain by that?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Hi Quinn, I see that I never replied to your message.

The goal of listening to Darwin notifications is to communicate between an iOS test suite and macOS host.

The macOS host controls the test suite, e.g. when a button is pressed the test suite performs a certain test. I wanted to use notifications to indicate that a test has been completed.

By now, I have found some workarounds, but I can still see the value in being able to successfully observe iOS notifications from macOS.

Using devicectl to observe Darwin Notifications
 
 
Q