2

我正在构建一个源代码编辑器扩展,当它被触发时,我想显示一个警报。

我试过这个:

let alert = NSAlert()
alert.messageText = "Hello world"
alert.informativeText = "Information text"
alert.addButton(withTitle: "OK")
alert.addButton(withTitle: "Cancel")
alert.runModal()

但我得到这个错误:

例外:NSWindow 拖动区域应该只在主线程上无效!NSWindow 拖动区域应该只在主线程上无效!

先感谢您

4

0 回答 0