未在AppDelegate中调用applicationShouldTerminate且未发送NSApplicationWillTerminateNotification [英] applicationShouldTerminate not called in AppDelegate and NSApplicationWillTerminateNotification not being sent

查看:281
本文介绍了未在AppDelegate中调用applicationShouldTerminate且未发送NSApplicationWillTerminateNotification的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用最新的Catalina上的XCode 11.1,并且没有调用我的应用程序的退出事件.如果我从任何地方观察它,都不会在AppDelegate中找到applicationShouldTerminate,也不会得到NSApplicationWillTerminateNotification.这是使用默认情节提要的XCode应用模板中的默认退出行为(使用菜单quit命令,Command-Q或使用applicationShouldTerminateAfterLastWindowClosed返回YES关闭窗口).

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.

使用全新的Xcode项目模板会发生这种情况(如果我启动新的macOS"App"模板,则将applicationShouldTerminate方法添加到应用程序委托中.)

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).

正在调用诸如applicationShouldTerminateAfterLastWindowClosed之类的其他委托方法.

Other delegate methods like applicationShouldTerminateAfterLastWindowClosed are being called.

我是在做些可怕的错误,还是在卡塔琳娜(Catalina)弄乱了?

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

推荐答案

好吧,我想通了,这是因为似乎NSSupportsSuddenTermination现在默认处于打开状态.

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

这篇关于未在AppDelegate中调用applicationShouldTerminate且未发送NSApplicationWillTerminateNotification的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆