I'm looking into a newer XPC API available starting with macOS 14. Although it's declared as a low-level API I can't figure it how to specify code signing requirement using XPCListener and XPCSession. How do I connect it with xpc_listener_set_peer_code_signing_requirement and xpc_connection_set_peer_code_signing_requirement which require xpc_listener_t and xpc_connection_t respectively?
Foundation XPC is declared as a high-level API and provides easy ways to specify code signing requirements on both ends of xpc.
I'm confused with all these XPC APIs and their future:
-
Newer really high-level XPCListener and XPCSession API (in low-level framework???)
-
Low-level xpc_listener_t & xpc_connection_t -like API. Is it being replaced by newer XPCListener and XPCSession?
-
How is it related to High-level Foundation XPC? Are NSXPCListener and NSXPCConnection going to be deprecated and replaced by XPCListener and XPCSession??
I can't figure it how to specify code signing requirement
Right. This isn’t any subtlety here, it’s just that this feature is missing from the new API )-: I’m pretty sure that we have a bug about this already but, regardless, if this is something you’d like to see added, I encourage you to file your own enhancement request for it.
Please post your bug number, just for the record.
Are NSXPCListener and NSXPCConnection going to be deprecated and replaced by XPCListener and XPCSession??
Sadly, I’m not able to predict The Future™.
My take on the current situation is that each of the APIs is tightly bound to a language:
-
The original low-level API is very C-ish.
-
NSXPCConnection
and friends are very Objective-C-ish. -
The new-level API is very Swift-ish.
You can use all three from Swift — interoperability is its superpower — but that comes with varying degrees of difficulty.
As to what the future will hold, I’m hoping that we ship an XPC transport for the Swift Distributed Actors facility. However, there’s been no official announcements about that, and I’m certainly not going to implement it myself as sample code (-:
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"