Shutting down M1 Mac - app no longer able to extend time?

Hi all,

so, in my app Transloader, when the app is terminated, I sync the Mac's "turned off" status to iCloud. This works on Intel Macs and on Apple silicon Macs when the user manually quits the app.

However, on Apple silicon Macs, when the user shuts down or restarts the Mac and the app is terminated that way, the app is terminated right away (doesn't even receive the -applicationWillTerminate: call), so I'm unable to properly sync the status. This still works on Intel Macs, as far as I know.

So, is there any new API to extend the Mac's shutdown a little longer to finish my sync?

Currently, I use -applicationShouldTerminate:, returning NSTerminateLater, and after syncing, calling -replyToApplicationShouldTerminate:YES . Again, this works fine on Intel Macs if the user manually quits, as well as if the Intel Mac shuts down, but on Apple silicon, it only works if the user manually quits - a shutdown results in the app being terminated without even receiving a -applicationWillTerminate: call.

Both NSSupportsSuddenTermination and NSSupportsAutomaticTermination are disabled in the app's Info.plist.

Thank you for any insights,

  • Matt

Accepted Reply

after a lengthy conversation with an Apple Engineer, this is desired behavior on macOS Monterey and newer, so that .accessory and .prohibited apps are more or less killed outright when restarting, logging out of or shutting down the Mac, in order to reduce shutdown times. Too bad, imho.

Replies

Update: It's a macOS Monterey issue, not an Apple silicon / Intel issue.

Also, I found out it has to do with having set NSApp activationPolicy to .accessory or .prohibited - if those are set, the app is terminated prematurely on shutdown / restart (-applicationWillTerminate: is never called). If it's .regular, it works like it should.

after a lengthy conversation with an Apple Engineer, this is desired behavior on macOS Monterey and newer, so that .accessory and .prohibited apps are more or less killed outright when restarting, logging out of or shutting down the Mac, in order to reduce shutdown times. Too bad, imho.