Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

applicationShouldTerminate not called in AppDelegate and NSApplicationWillTerminateNotification not being sent

I'm on XCode 11.1 on latest Catalina and none of my app's quit events are being called. applicationShouldTerminate in the AppDelegate nor do I get NSApplicationWillTerminateNotification if I observe it from anywhere. This is from the default quit behavior (Using the menu quit command, Command-Q, or closing the window with applicationShouldTerminateAfterLastWindowClosed returning YES) from the XCode app template using the default storyboard.

This happens with a brand new Xcode project template (If I start a new macOS "App" template, then add the applicationShouldTerminate method to the app delegate).

Other delegate methods like applicationShouldTerminateAfterLastWindowClosed are being called.

Am I doing something horribly wrong or is something messed up with Catalina?

like image 696
toastie Avatar asked Dec 14 '22 10:12

toastie


1 Answers

Well, I figured it out and it's because it seems that NSSupportsSuddenTermination is on by default now.

To disable sudden termination, set this boolean property to NO in the app's information property list file Info.plist: enter image description here

like image 196
toastie Avatar answered Dec 28 '22 10:12

toastie