I'm developing an app to parse package.swift files.
When I run the following test code with "App Sandbox=NO" all works well. But I get the dreaded "xcrun: error: cannot be used within an App Sandbox" when "App Sandbox=YES". Fair enough.
So what I'm trying to do is to run "swift" inside my sandbox. To do this, I added the small "swift" command file into my Assets and in my project, and using that. However I still get the same error.
How can I run "swift" in my sandbox? or is there another way to parse package.swift files with "App Sandbox=YES"?
Using Xcode 12.2 beta, macos 10.15.6 app.
When I run the following test code with "App Sandbox=NO" all works well. But I get the dreaded "xcrun: error: cannot be used within an App Sandbox" when "App Sandbox=YES". Fair enough.
So what I'm trying to do is to run "swift" inside my sandbox. To do this, I added the small "swift" command file into my Assets and in my project, and using that. However I still get the same error.
How can I run "swift" in my sandbox? or is there another way to parse package.swift files with "App Sandbox=YES"?
Code Block import SwiftUI import Foundation struct ContentView: View { var body: some View { Text("do the test").onAppear(perform: doTest) } func doTest() { if let swiftURL = Bundle.main.url(forResource: "swift", withExtension: nil) { let task = Process() task.executableURL = URL(fileURLWithPath: swiftURL.absoluteString) // path to my local .cachesDirectory, where I added a Package.swift file // e.g. FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask) let arg3 = "/Users/......" task.arguments = ["package", "--package-path", arg3, "dump-package"] let pipe = Pipe() task.standardOutput = pipe do { try task.run() } catch (let error) { print("======> error \(error.localizedDescription)") } task.waitUntilExit() let data = pipe.fileHandleForReading.readDataToEndOfFile() print("---> data: \(data)") } } }
Using Xcode 12.2 beta, macos 10.15.6 app.