Hello,
I'm struggling to understand how I can use NSXPC API to communicate between two processes on iOS. The problem which I want to solve is how to pass some information from VPN tunnel to the VPN app.
I'm looking at the XPC documentation and for iOS I can create NSXPCListener
only with the following functions:
service()
anonymous()
Both return NSXPCListener
instance. But the question remains, how to connect to such an instance?
In NSXPConnection
API I see only one option for iOS:
init(listenerEndpoint: NSXPCListenerEndpoint)
Other constructors accepting serviceName
or machServiceName
are available only form macOS.
I feel like the problem of communicating between two processes should be easy, but surprisingly I did find it quite difficult on iOS. Can you please advice if this is a proper API for my use case? Or maybe is there some better one, which I'm not aware of?
If this is a proper API, how should I create a connection between two apps? How to pass a listener from one process to the other?