XPC solution

Hi,

We are building an sandbox enabled app which contains

1. One launch daemon
2. One launch agent
3. System extension which is contained in launch agent

The launch daemon is outside of the sandbox. The launch agent and system extension is inside the sandbox.

The launch agent is in good communicating with system daemon already. But recently the use case I am meeting is to comunnication between launch agent, launch daemon and systen extension daemon.

1. Launch agent sends request to launch daemon
2. launch daemon sends response to launch agent

And

1. System extension sends request to launch daemon
2. Launch daemon sends response to system extension

I have read some articles on the forum and understand that we can use machServices to make the XPC connection fulfilled in launch daemon.

And we can use com.apple.security.temporary-exception.mach-lookup.global-name to eliminate the sandbox limitation between the daemon and agents.

But when we do experiment, it always return

Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.*****.******" UserInfo={NSDebugDescription=connection to service named com.****.*****}

I understand that the suggested debug method is making anonymous listener in the same process. But that looks like more for XPC service. I am not sure how to debug in the launchd. Is there any suggestion?

BTW, the daemon is mainly implemented in C++ and the agent is in swift. So I use NSXPCConnection on both sides. I am wondering if it is the best fit for our purpose.

Is there any good example that I can follow?

XPC solution
 
 
Q