Type Alias | XPC
A C type that performs tasks for clients across process boundaries.
typealias xpc_listener_t = OS_xpc_listener
To implement an XPC service, create a listener and respond to incoming session requests.
Creating a listener
- xpc_listener_incoming_session_handler_t
typealias xpc_listener_incoming_session_handler_t— A block that receives an incoming peer session request from a client.
Working with code signing
- xpc_listener_set_peer_code_signing_requirement(_:_:))
func xpc_listener_set_peer_code_signing_requirement(xpc_listener_t, UnsafePointer<CChar>) -> Int32—
See Also
Interprocess communication
xpc_listener_incoming_session_handler_t
Type Alias | XPC
A block that receives an incoming peer session request from a client.
typealias xpc_listener_incoming_session_handler_t = (xpc_session_t) -> Void
When a client connects to your service, the system invokes this block with a session that represents the server’s connection to the client. Before returning from this block, you must do one of the following:
- Call xpc_session_set_incoming_message_handler to set a handler for incoming messages.
- Call xpc_session_cancel to cancel the session.
Important: Failure to take one of these actions results in an API misuse crash.
When the incoming_session_handler returns, the system automatically activates the peer session unless you explicitly cancel it.
xpc_listener_set_peer_code_signing_requirement(_:_:)
Function | XPC
func xpc_listener_set_peer_code_signing_requirement(_ listener: xpc_listener_t, _ requirement: UnsafePointer<CChar>) -> Int32