The Daemons and Services Programming Guides tells that it is possible to return a proxy object through an open XPC connection, even as a reply block parameter.

Passing an Object By Proxy

Most of the time, it makes sense to copy objects and send them to the other side of a connection. However, this is not always desirable. In particular:

If you need to share a single instance of the data between the client application and the helper, you must pass the objects by proxy. If an object needs to call methods on other objects within your application that you cannot or do not wish to pass across the connection (such as user interface objects), then you must pass an object by proxy—either the caller, the callee (where possible), or a relay object that you construct specifically for that purpose. The downside to passing objects by proxy is that performance is significantly reduced (because every access to the object requires interprocess communication). For this reason, you should only pass objects by proxy if it is not possible to pass them by copying.

You can configure additional proxy objects similarly to the way you configured the remoteObjectInterface property of the initial connection. First, identify which parameter to a method should be passed by proxy, then specify an NSXPCInterface object that defines the interface for that object.

First questions come: how should the object to be passed by proxy be defined? As an object conforming to NSXPCProxyCreating protocol? Should remoteObjectProxy and remoteObjectProxyWithErrorHandler: method be implemented then?

An example follows, that is not clear at all to me. In particular I don't understand where should I call the NSXPCInterface method (setInterface:forSe

Edit
Report