无法加载Info.plist异常(eGPUOverrides)

时间:2018-11-15 21:06:32

标签: swift macos wkwebview swift4.2

我试图在WKWebView中加载可打印的html内容,但是在MacOS Mojave上出现以下错误。输出如下:

[default] Unable to load Info.plist exceptions (eGPUOverrides)

RETURNING UnknownFS PLACEHOLDER: 33D3E944-F72B-32A1-A693-5179CF9A6BEF

errors encountered while discovering extensions: Error Domain=PlugInKit Code=13 "query cancelled" UserInfo={NSLocalizedDescription=query cancelled}

这是我的代码,我不知道为什么视图无法Web视图甚至无法加载从segue传递的html内容。请问我做错了什么?

class PrintPreviewVC: NSViewController,  WKUIDelegate, WKScriptMessageHandler {

var vc: DownloadDataVC!
var htmlContent: String = ""
var currentOrientation = "portrait"

var webView: WKWebView!

override func loadView() {
    let webConfiguration = WKWebViewConfiguration()
    let script = WKUserScript(source: "window.print = function() { window.webkit.messageHandlers.print.postMessage('print') }", injectionTime: WKUserScriptInjectionTime.atDocumentEnd, forMainFrameOnly: true)
    webConfiguration.userContentController.addUserScript(script)
    webConfiguration.userContentController.add(self, name: "print")
    webView = WKWebView(frame: .zero, configuration: webConfiguration)
    webView.uiDelegate = self
    view = webView
}
override func viewDidLoad() {
    super.viewDidLoad()


    webView.loadHTMLString(htmlContent, baseURL: nil)
}

func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
    if message.name == "print" {
        printCurrentPage()
    } else {
        print("Some other message sent from web page...")
    }
}

func printCurrentPage() {
    print("content printed")
}
}

0 个答案:

没有答案