Hacker News new | ask | show | jobs
by fierarul 2035 days ago
I'm still salty that the macOS Notification Center was introduced as a "for-pay" API as it initially worked only on AppStore apps and then on signed apps.

I'm still not sure if it works on unsigned apps, but considering all apps must be notarized on macOS, it doesn't really matter anymore.

1 comments

> I'm still not sure if it works on unsigned apps

You don’t even need an app; you can show a dialog from AppleScript. Using a shell:

  /usr/bin/osascript -e 'display notification "whatever"'
You can add a title, subtitle, and sound[1]. Adding a custom icon is trickier and does require a built app.

[1]: https://developer.apple.com/library/archive/documentation/La...

I knew you can use `osascript` but this still does not tell me if it works with unsigned apps or not. For all we know `osascript` is signed which means it respects the rules.
You can call `osascript` from inside your app, or you can export an AppleScript script as an app. So yes, it works on unsigned apps. It has the same Gatekeeper caveats as any other unsigned app, but there’s nothing about notifications that’s especially locked.
Can I natively call the Objective C API from an unsigned app or not?