嵌入式WebView OSX中未显示Javascript警报

嵌入式WebView OSX中未显示Javascript警报,javascript,macos,cocoa,swift,webview,Javascript,Macos,Cocoa,Swift,Webview,我有一个嵌入式的WebViewtoub,它加载一个本地HTML文件 我的警报警报(“某些消息”)未被激发 UIDelegate设置在toub 我在这里查过: 及 提出 func toWeb(sender: WebView!, runJavaScriptAlertPanelWithMessage message: String!) { let myPopup:NSAlert = NSAlert() myPopup.addButtonWithTitle("OK") myP

我有一个嵌入式的
WebView
toub
,它加载一个本地
HTML
文件

我的警报
警报(“某些消息”)未被激发

UIDelegate设置在
toub

我在这里查过:

提出

func toWeb(sender: WebView!, runJavaScriptAlertPanelWithMessage message: String!) {

    let myPopup:NSAlert = NSAlert()
    myPopup.addButtonWithTitle("OK")
    myPopup.messageText = "An alert";
    myPopup.informativeText = "Message"
    if myPopup.runModal() == NSAlertFirstButtonReturn {

    }
然而,我仍然没有从我的嵌入式
WebVieW中得到任何警报

 override func webView(sender: WebView!, runJavaScriptAlertPanelWithMessage 

    message: String!, initiatedByFrame frame: WebFrame!) {

            println("Alert sent")
            let myPopup:NSAlert = NSAlert()
            myPopup.addButtonWithTitle("OK")
            myPopup.messageText = "Title";
            myPopup.informativeText = "Message"
            if myPopup.runModal() == NSAlertFirstButtonReturn {

             }