在我的应用程序委托(delegate)中,我设置了回调以在窗口关闭时停止程序。
func applicationShouldTerminateAfterLastWindowClosed(sender: NSApplication) -> Bool {
return true
}
但这不起作用,因为(我假设)有一个异步蓝牙任务正在运行。停止一切运行和清理的最佳方法是什么?
最佳答案
我用的是这种方法
[NSApp performSelector:@selector(terminate:) withObject:nil afterDelay:0];
关于swift - 在窗口关闭时停止异步操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30835817/