is there is a way to create a XPC there is 1 request, multiple responses?
Yes. Well, technically no, because XPC is request/response based, so there can only be one response per se. However, XPC supports ‘one way’ messages, and you can use that to achieve this goal.
Exactly how you do that depends on the API you’re using (C vs NSXPCConnection
), the semantics of your protocol, and design decisions that you have to make for yourself. If you care to share some details, I can elaborate.
One specific gotcha to watch out for is unbounded messaging from the server to the client. If you send a bunch of one-way messages from the server to the client and the client stops responding, the messages build up in the server’s memory. It’s possible that this could cause the server to run out of memory, which would be Bad™. There are various ways to fix this but a good option is a barrier, for example, using -[NSXPCConnection scheduleSendBarrierBlock:]
.
Oh, and if your overall goal here is simply to send progress updates to the client, you can use NSProgress
for that.
or can I make a request and reply it only when the app/service is
closed?
I don’t understand this.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"