【问题标题】:Stop async operations on window close在窗口关闭时停止异步操作
【发布时间】:2015-06-15 00:06:14
【问题描述】:

在我的应用程序委托中,我放置了回调以在窗口关闭时停止程序。

 func applicationShouldTerminateAfterLastWindowClosed(sender: NSApplication) -> Bool {
        return true
    }

但这不起作用,因为(我假设)有一个异步蓝牙任务正在运行。停止一切运行和清理的最佳方法是什么?

【问题讨论】:

    标签: swift cocoa appdelegate


    【解决方案1】:

    我使用这种方法

    [NSApp performSelector:@selector(terminate:) withObject:nil afterDelay:0];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-07-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多