【发布时间】:2020-02-07 16:24:20
【问题描述】:
我有一个非沙盒化的 macOS 应用程序,它通过以下方法愉快地调用其资源包中的 shell 脚本:
class func runShell(launchPath: String, arguments: [String] = [], waitUntilExit: Bool) -> Void {
let task = Process()
task.launchPath = launchPath
task.arguments = arguments
let pipe = Pipe()
task.standardOutput = pipe
task.launch()
if waitUntilExit {
task.waitUntilExit()
}
}
ABCProcessManager.runShell(launchPath: scriptPath.path, arguments: ["-workingdirectory", path], waitUntilExit: true)
我正在尝试将应用程序转换为沙盒应用程序(用于 App Store 上传),但它在调用脚本时会冻结。
脚本管理一个启动代理。加载、卸载、启动、停止。
我需要如何更改我的代码才能使其在沙盒开启的情况下工作?也许有一种管理启动代理的“沙盒方式”?
【问题讨论】:
-
我不认为你可以,这几乎会破坏沙盒的全部意义。不过,我认为您可以为此类事情提供特权 XPC 服务
标签: swift macos appstore-sandbox