Documentation
¶
Overview ¶
Command addservice is an XPC service that adds two numbers.
It is the Go equivalent of Apple's low-level XPC service template, the one whose main.c calls xpc_listener_create and replies from an incoming message handler. The service name and the message keys match that template, so this binary can be dropped into the same .xpc bundle:
dev.tmc.sample-xpc-service-ll
{"firstNumber": int64, "secondNumber": int64} -> {"result": int64}
An XPC service is launched by launchd on demand, not run from a shell. It lives in a .xpc bundle inside Contents/XPCServices of a host application, and only a process inside that application can reach it. examples/xpc/ build-bundle.sh assembles both sides:
./examples/xpc/build-bundle.sh ~/tmp/AddDemo.app ~/tmp/AddDemo.app/Contents/MacOS/AddDemo -first 23 -second 19