NSPortNameServer/NSXPCConnection in beta SDK

Number:rdar://43890313 Date Originated:August 30 2018, 1:08 PM
Status:Open Resolved:
Product:macOS + SDK Product Version:Xcode 10.0 beta 6 (10L232m); macOS SDK 10.14
Classification:Foundation Reproducible:I Didn't Try
NSPortNameServer has been deprecated in favor of NSXPCConnection. However, NSXPCConnection does not provide any way for two sandboxed executables from *different bundles* to connect to each other. The only initializers for NSXPCConnection are "initWithListenerEndpoint:", which requires a listener endpoint received from an existing connection; "initWithMachServiceName:options:", which is not an option for MAS apps which cannot have launch agents; and "initWithServiceName:", which requires (as far as is documented) an XPC service in the same bundle. Therefore, it is impossible for two executables from different bundles to establish an NSXPCConnection. This used to be possible by registering a mach port and using that to communicate, but now that method is deprecated with no replacement.

The best solution to this issue is creating some kind of NSPortNameServer for XPC connections (maybe NSXPCNameServer). This adds additional support for establishing XPC connections to allow migration from mach ports and NSConnection.

Xcode 10.0 beta 6 (10L232m); macOS SDK 10.14


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!