NSDistributedNotificationCenter addObserver silently fails if name is nil

I'm not sure if this is a bug or an API change, but we have an app which relies on distributed notifications which didn't work on Catalina. After debugging I think the problem is that specifying a "name: nil" in addObserver fails silently.

The documentation suggests name:nil is an acceptable value, there are numerous examples online which use name:nil, and there's nothing in the release notes to suggest this has changed, but the fact is that my application starts working again if I call addObserver and specify a non nil notification name.

I've submitted a Feedback report, as if this is an API change they should update the documentation (and provide a helpful log message). I'm posting here because I thought other people might like to know this might be the cause of any problems they're having with distributed notifications.


Apple have now replied to my Feedback submission to confirm that the API has changed. Specifying a nil name in addObserver is now a privileged operation, so for practical purposes all applications currently using a nil name will stop receiving notifications when they move to Catalina, and will need to be updated to use a specified name.

I just tried to receive notifications with "name:nil" in a simple console app with root privileges but did not receive anything. Were you able to receive notifications using "name:nil" with elevated privileges?