My application handles multiple connections through the USB ports as serial devices that use termios, the application needs to send and receive a large amount of data for each open connection, but in very rare cases the process that handles the data received through a specific USB port crashes, collapsing the application and affecting the other open connections. To minimize the damage, I intend to use NSXPCConnection instances. My question to this forum is: How many similar instances of NSXPCConnection can be opened for the same application?
Quite possibly.
OK, I had a chance to look into this in depth last week. Unfortunately the news is not great. The strategy I outlined in my 20 Nov 2017 post works for
launchd
daemons and agents but it does not work for XPC Services. The problem here is that that the XPC Service’s name is
only registered in the app’s context. It is not registered in the XPC Service’s context, so a child process launched by the XPC Service can’t connect to it.
The enhancement request that ManuelCSolis filed about this back on 21 Nov 2017 (r. 35659284) is still open and we’re using it to track the requirement for a supported way to implement multiple instances. If you have a product that would benefit from this, it wouldn’t hurt to file your own enhancement request describing its specific requirements.
In the meantime, if you need to do this you should get in touch with DTS. While there’s no general solution to this problem, in some cases their may be a special-case solution that meets your needs.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"