I have created two cocoa applications for macOS and I am trying to open one application from another on a button click but this returns an error Domain=NSPOSIXErrorDomain Code=13 "Permission denied" I even removed the app sandboxing in both the applications but still the same error, Any help would be appreciated.
Development Environment:
OSX: 10.14.5 (Mojave)
Xcode: 11.2.1
Swift: 4.2
Code Sample:
@IBAction func buttonAction(_ sender: Any) {
        let task = Process.init()
        task.launchPath = "/Users/JohnDoe/Desktop/ExampleApp.app"
        task.arguments = ["--args", "hello"]
        do{
            try task.run()
        }
        catch{
            print("Error: ", error)
        }
        task.waitUntilExit()
}
From the perspective of the shell the application bundle is a folder, you have to launch the executable
/Users/JohnDoe/Desktop/ExampleApp.app/Contents/MacOS/ExampleApp
Disabling the sandbox is required to run something with Process
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With