{"id":26782,"date":"2019-10-04T17:01:43","date_gmt":"2019-10-04T21:01:43","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=26782"},"modified":"2025-06-17T15:15:38","modified_gmt":"2025-06-17T19:15:38","slug":"nsdistributednotificationcenter-no-longer-supports-nil-names","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2019\/10\/04\/nsdistributednotificationcenter-no-longer-supports-nil-names\/","title":{"rendered":"NSDistributedNotificationCenter No Longer Supports nil Names"},"content":{"rendered":"<p><a href=\"https:\/\/forums.developer.apple.com\/thread\/123629\">merlinme<\/a> (via <a href=\"https:\/\/twitter.com\/lapcatsoftware\/status\/1179914857249935361\">Jeff Johnson<\/a>):<\/p>\n<blockquote cite=\"https:\/\/forums.developer.apple.com\/thread\/123629\">\n<p>I&rsquo;m not sure if this is a bug or an API change, but we have an app which relies on distributed notifications which didn&rsquo;t work on Catalina. After debugging I think the problem is that specifying a <code>name: nil<\/code> in <code>addObserver<\/code> fails silently.<\/p>\n<p>[&#8230;]<\/p>\n<p>Apple have now replied to my Feedback submission to confirm that the API has changed. Specifying a <code>nil<\/code> name in <code>addObserver<\/code> is now a privileged operation, so for practical purposes all applications currently using a <code>nil<\/code> name will stop receiving notifications when they move to Catalina, and will need to be updated to use a specified name.<\/p>\n<\/blockquote>\n<p><a href=\"https:\/\/mjtsai.com\/blog\/2019\/09\/17\/breaking-the-nsdata-description-contract\/\">Another<\/a> breaking change to an API that&rsquo;s been around since Mac OS X 10.10, without updating the <a href=\"https:\/\/developer.apple.com\/documentation\/foundation\/nsdistributednotificationcenter\/1414136-addobserver\">documentation<\/a> or mentioning the change in a release note:<\/p>\n<blockquote cite=\"https:\/\/developer.apple.com\/documentation\/foundation\/nsdistributednotificationcenter\/1414136-addobserver\"><p><code>notificationName<\/code>\nThe name of the notification for which to register the observer; that is, only notifications with this name are delivered to the observer. When <code>nil<\/code>, the notification center doesn&rsquo;t use a notification&rsquo;s name to decide whether to deliver it to the observer.<\/p><\/blockquote>\n<p>I guess maybe there are privacy reasons to prevent an app from seeing notifications from other apps or the system. However:<\/p>\n<ul>\n<li>Distributed notifications have always been public. It was never correct to put sensitive information in them.<\/li>\n<li>This doesn&rsquo;t actually prevent monitoring the notifications. You just have to know their names first, which you can figure out through static analysis and\/or debugging.<\/li>\n<li>It does make things more difficult for legitimate apps that are trying to improve the user experience by monitoring and responding to system changes.<\/li>\n<\/ul>\n\n<p id=\"nsdistributednotificationcenter-no-longer-supports-nil-names-update-2025-06-17\">Update (<a href=\"#nsdistributednotificationcenter-no-longer-supports-nil-names-update-2025-06-17\">2025-06-17<\/a>): <a href=\"https:\/\/x.com\/steipete\/status\/1934932341849288763\">Peter Steinberger<\/a>:<\/p>\n<blockquote cite=\"https:\/\/x.com\/steipete\/status\/1934932341849288763\"><p>Apple &#8230; just makes stuff so annoying. For <code>NSDistributedNotificationCenter<\/code> to work, binaries now need to be code signed since macOS 15. Else it just silently fails. No log or anything.<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>merlinme (via Jeff Johnson): I&rsquo;m not sure if this is a bug or an API change, but we have an app which relies on distributed notifications which didn&rsquo;t work on Catalina. After debugging I think the problem is that specifying a name: nil in addObserver fails silently. [&#8230;] Apple have now replied to my Feedback [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2019-10-04T21:01:47Z","apple_news_api_id":"c30fc318-3098-4d0f-8e42-73c579dca05c","apple_news_api_modified_at":"2025-06-17T19:15:41Z","apple_news_api_revision":"AAAAAAAAAAAAAAAAAAAAAA==","apple_news_api_share_url":"https:\/\/apple.news\/Aww_DGDCYTQ-OQnPFedygXA","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[69,466,164,30,1666,2598,71],"class_list":["post-26782","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-cocoa","tag-codesigning","tag-documentation","tag-mac","tag-macos-10-15","tag-macos-15-sequoia","tag-programming"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/26782","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=26782"}],"version-history":[{"count":2,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/26782\/revisions"}],"predecessor-version":[{"id":48112,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/26782\/revisions\/48112"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=26782"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=26782"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=26782"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}