How to launch a sandboxed process as a standalone application?

Hello, I have an application that needs to be published to the App Store.

This application consists of two processes, A and B, where B is a child process of A.

I found that if process B needs to be launched as a child process of A in sandbox mode, it is necessary to set the following keys in the entitlements.plist file:

<key>com.apple.security.app-sandbox</key><true/><key>com.apple.security.inherit</key><true/>

However, after setting these keys, process B can no longer be launched directly.

This issue is particularly prominent because process B has a window and a Dock icon — in this case, if the user pins the Dock icon, they will be unable to launch process B.

Could you please advise on a solution to this problem?

Answered by DTS Engineer in 878877022
process B can no longer be launched directly.

Correct.

This issue is particularly prominent because process B has a window and a Dock icon

If program B works when run independently, rather than as a child process, then you shouldn’t start it as a child process. Instead launch it as a separate app. There are a variety of ways you can do that, but the two most common are:

  • If you want the program to be running all the time, enable that via Service Management framework.
  • Otherwise, start it with NSWorkspace.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

process B can no longer be launched directly.

Correct.

This issue is particularly prominent because process B has a window and a Dock icon

If program B works when run independently, rather than as a child process, then you shouldn’t start it as a child process. Instead launch it as a separate app. There are a variety of ways you can do that, but the two most common are:

  • If you want the program to be running all the time, enable that via Service Management framework.
  • Otherwise, start it with NSWorkspace.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

How to launch a sandboxed process as a standalone application?
 
 
Q