My current implementation has the following structure:
The strategy I'm considering right now is to drop the reference to Remote and request it from Connection (unless invalidated) whenever it's needed. But that's a bit inconvenient as I need to somehow refer to Connection from Local.
The latter can be solved via a weak (or unowned?) reference from Local to Connection. But then it's important to know whether Connection will retain Local (its exportedObject) until deallocated or until invalidated.
Please advise what'd be the best way to proceed.
In my implementation of NSXPCListenerDelegate I create the Remote object via the remoteObjectProxy* family of API.
I then create the Local object that has a strong reference to Remote
Local is then set as exportedObject of the Connection object
The strategy I'm considering right now is to drop the reference to Remote and request it from Connection (unless invalidated) whenever it's needed. But that's a bit inconvenient as I need to somehow refer to Connection from Local.
The latter can be solved via a weak (or unowned?) reference from Local to Connection. But then it's important to know whether Connection will retain Local (its exportedObject) until deallocated or until invalidated.
Please advise what'd be the best way to proceed.