I have this protocol method in the XPC server:
- (void)ping:(void (^)(NSString* reply))resultHandler;
Then I connect to the XPC server:
xpc.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(I_LoginHelperProtocol)]
_agent = [xpc remoteObjectProxyWithErrorHandler:^(NSError *error) {
/
MyLog(@"XPC error: %@", error);
handler(error);
}];
Then I call the ping method (or other methods) on the agent:
_agent ping:^(NSString *reply) {
[_appLog log:@"LoginHelper Agent ping reply: %@ in thread %@", reply, [NSThread currentThread]];
}];
My questions is - is it guaranteed that the reply handler is always dispatched in one single thread, or is it possible for XPC service to spawn a new thread to service the request?