1

在我的应用中注册 url 激活时

NSAppleEventManager.shared().setEventHandler(self, andSelector: #selector(self.handleEvent(_:with:)), forEventClass: AEEventClass(kInternetEventClass), andEventID: AEEventID(kAEGetURL))

当我的应用程序在我的 func 'handleEvent()' 激活结束时,我的应用程序在 Mac 中窃取用户的焦点时,我在我的应用程序中收到回调。

我不希望我的应用程序窃取焦点,因为我在后台运行,用户甚至不知道为什么他当前的应用程序失去了焦点。

如何将其设置为继续运行而不窃取用户的注意力?

4

1 回答 1

1

由于没有得到答案,我切换了方法并使用DistributedNotificationCenter 在 2 个应用程序之间进行通信。

使用此解决方案不会窃取焦点。

于 2018-10-09T08:42:11.970 回答