以编程方式以隐身模式启动Chrome

时间:2015-07-01 22:04:28

标签: macos swift

我试图弄清楚如何告诉浏览器(在此示例中为Google Chrome)如何以隐身模式打开。我使用NSWorkspace openurls方法,但我无法找到任何方式发送应用程序额外参数。

func openUrlWithBrowser(url: String, bundleIdentifier: String) {
    var eventDescriptor: NSAppleEventDescriptor? = NSAppleEventDescriptor()
    var errorInfo : NSDictionary? = nil
    var appleEventManager:NSAppleEventManager = NSAppleEventManager.sharedAppleEventManager()
    var urls = [NSURL(string: url)!]
    NSWorkspace.sharedWorkspace().openURLs(urls, withAppBundleIdentifier: bundleIdentifier, options: NSWorkspaceLaunchOptions.Default, additionalEventParamDescriptor: nil, launchIdentifiers: nil)
}

0 个答案:

没有答案