问题
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?
回答1:
Well, I figured it out and it's because it seems that NSSupportsSuddenTermination is on by default now.
回答2:
NSSupportsSuddenTermination is also called 'Application can be killed immediately when user is shutting down or logging out' within Xcode, and seems enabled by default.
Thanks @toastie
来源:https://stackoverflow.com/questions/58491810/applicationshouldterminate-not-called-in-appdelegate-and-nsapplicationwilltermin