使用参数启动应用程序,但 NSWorkspace 不起作用

2024-02-23

我想用参数打开 FileZilla (ftp 应用程序)。

它正在与NSTask(又名过程):

let process:Process = Process()
process.launchPath = appURL.path
process.arguments = ["ftp://1.2.3.4"]
process.launch()

它不适用于NS工作区:

try! NSWorkspace.shared().launchApplication(
   at: appURL,
   options: .default,
   configuration: [NSWorkspaceLaunchConfigurationArguments:["ftp://1.2.3.4"]]
)

With 不工作我的意思是,FileZilla 启动了,但争论并没有被忽略。

API 看起来很简单,但我不知道我在这里做错了什么。

我想使用 NSWorkspace 的原因是 NSTask 应用程序不会在前台启动。


None

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用参数启动应用程序,但 NSWorkspace 不起作用 的相关文章

随机推荐