Type Alias | XPC
A C type that sends messages to a server process.
typealias xpc_session_t = OS_xpc_session
XPC sessions are stateful connections you use to send structured messages to a separate process. Once established, a session remains active until one side of the connection cancels it, at which point the system invalidates the connection. Unlike lower-level xpc_connection functions, the system makes no attempt to reestablish a connection or relaunch the service.
Creating a session
- xpc_session_t
typealias xpc_session_t— - xpc_session_create_mach_service(_:_:_:_:))
func xpc_session_create_mach_service(UnsafePointer<CChar>, dispatch_queue_t?, xpc_session_create_flags_t, AutoreleasingUnsafeMutablePointer<xpc_rich_error_t?>?) -> (any OS_xpc_object)?— - xpc_session_create_xpc_service(_:_:_:_:))
func xpc_session_create_xpc_service(UnsafePointer<CChar>, dispatch_queue_t?, xpc_session_create_flags_t, AutoreleasingUnsafeMutablePointer<xpc_rich_error_t?>?) -> (any OS_xpc_object)?— - xpc_session_create_flags_t
struct xpc_session_create_flags_t— - xpc_session_copy_description(_:))
func xpc_session_copy_description(any OS_xpc_object) -> UnsafeMutablePointer<CChar>?— - xpc_session_set_target_queue(_:_:))
func xpc_session_set_target_queue(any OS_xpc_object, dispatch_queue_t?)—
Managing life cycle
- xpc_session_activate(_:_:))
func xpc_session_activate(any OS_xpc_object, AutoreleasingUnsafeMutablePointer<xpc_rich_error_t?>?) -> Bool— - xpc_session_cancel(_:))
func xpc_session_cancel(any OS_xpc_object)— - xpc_session_set_cancel_handler(_:_:))
func xpc_session_set_cancel_handler(any OS_xpc_object, xpc_session_cancel_handler_t)— - xpc_session_set_incoming_message_handler(_:_:))
func xpc_session_set_incoming_message_handler(any OS_xpc_object, xpc_session_incoming_message_handler_t)— Sets a handler to receive incoming messages for a session. - xpc_session_incoming_message_handler_t
typealias xpc_session_incoming_message_handler_t— - xpc_session_cancel_handler_t
typealias xpc_session_cancel_handler_t—
Sending messages
- xpc_rich_error_t
typealias xpc_rich_error_t— A type that describes an error, and whether you can retry the operation that experienced the error. - xpc_rich_error_can_retry(_:))
func xpc_rich_error_can_retry(xpc_rich_error_t) -> Bool— Returns a Boolean that indicates whether you can retry the operation that experienced an error. - xpc_rich_error_copy_description(_:))
func xpc_rich_error_copy_description(xpc_rich_error_t) -> UnsafeMutablePointer<CChar>?— Copies the string description of an error. - xpc_session_send_message(_:_:))
func xpc_session_send_message(any OS_xpc_object, xpc_object_t) -> xpc_rich_error_t?— - xpc_session_send_message_with_reply_async(_:_:_:))
func xpc_session_send_message_with_reply_async(any OS_xpc_object, xpc_object_t, xpc_session_reply_handler_t)— - xpc_session_reply_handler_t
typealias xpc_session_reply_handler_t— - xpc_session_send_message_with_reply_sync(_:_:_:))
func xpc_session_send_message_with_reply_sync(any OS_xpc_object, xpc_object_t, AutoreleasingUnsafeMutablePointer<xpc_rich_error_t?>?) -> xpc_object_t?—
Working with code signing
- xpc_session_set_peer_code_signing_requirement(_:_:))
func xpc_session_set_peer_code_signing_requirement(xpc_session_t, UnsafePointer<CChar>) -> Int32—
See Also
Interprocess communication
xpc_rich_error_can_retry(_:)
Function | XPC
Returns a Boolean that indicates whether you can retry the operation that experienced an error.
func xpc_rich_error_can_retry(_ error: xpc_rich_error_t) -> Bool
true if you can try the operation again; otherwise false.
Parameters
- error: An error object that describes a failure.
See Also
Sending messages
- xpc_rich_error_t
- xpc_rich_error_copy_description(_:))
- xpc_session_send_message(_:_:))
- xpc_session_send_message_with_reply_async(_:_:_:))
- xpc_session_reply_handler_t
- xpc_session_send_message_with_reply_sync(_:_:_:))
xpc_rich_error_copy_description(_:)
Function | XPC
Copies the string description of an error.
func xpc_rich_error_copy_description(_ error: xpc_rich_error_t) -> UnsafeMutablePointer<CChar>?
The underlying string that describes the error, or nil if generating an a description fails.
Parameters
- error: An error object that describes a failure.
See Also
Sending messages
- xpc_rich_error_t
- xpc_rich_error_can_retry(_:))
- xpc_session_send_message(_:_:))
- xpc_session_send_message_with_reply_async(_:_:_:))
- xpc_session_reply_handler_t
- xpc_session_send_message_with_reply_sync(_:_:_:))
xpc_rich_error_t
Type Alias | XPC
A type that describes an error, and whether you can retry the operation that experienced the error.
typealias xpc_rich_error_t = xpc_object_t
See Also
Sending messages
- xpc_rich_error_can_retry(_:))
- xpc_rich_error_copy_description(_:))
- xpc_session_send_message(_:_:))
- xpc_session_send_message_with_reply_async(_:_:_:))
- xpc_session_reply_handler_t
- xpc_session_send_message_with_reply_sync(_:_:_:))
xpc_session_activate(_:_:)
Function | XPC
func xpc_session_activate(_ session: any OS_xpc_object, _ error_out: AutoreleasingUnsafeMutablePointer<xpc_rich_error_t?>?) -> Bool
See Also
Managing life cycle
- xpc_session_cancel(_:))
- xpc_session_set_cancel_handler(_:_:))
- xpc_session_set_incoming_message_handler(_:_:))
- xpc_session_incoming_message_handler_t
- xpc_session_cancel_handler_t
xpc_session_cancel(_:)
Function | XPC
func xpc_session_cancel(_ session: any OS_xpc_object)
See Also
Managing life cycle
- xpc_session_activate(_:_:))
- xpc_session_set_cancel_handler(_:_:))
- xpc_session_set_incoming_message_handler(_:_:))
- xpc_session_incoming_message_handler_t
- xpc_session_cancel_handler_t
xpc_session_copy_description(_:)
Function | XPC
func xpc_session_copy_description(_ session: any OS_xpc_object) -> UnsafeMutablePointer<CChar>?
See Also
Creating a session
- xpc_session_t
- xpc_session_create_mach_service(_:_:_:_:))
- xpc_session_create_xpc_service(_:_:_:_:))
- xpc_session_create_flags_t
- xpc_session_set_target_queue(_:_:))
xpc_session_cancel_handler_t
Type Alias | XPC
typealias xpc_session_cancel_handler_t = (xpc_rich_error_t) -> Void
See Also
Managing life cycle
- xpc_session_activate(_:_:))
- xpc_session_cancel(_:))
- xpc_session_set_cancel_handler(_:_:))
- xpc_session_set_incoming_message_handler(_:_:))
- xpc_session_incoming_message_handler_t
xpc_session_create_flags_t
Structure | XPC
struct xpc_session_create_flags_t
Type Properties
- inactive
static let inactive: xpc_session_create_flags_t— - none
static let none: xpc_session_create_flags_t— - privileged
static let privileged: xpc_session_create_flags_t—
Relationships
Conforms To
See Also
Creating a session
- xpc_session_t
- xpc_session_create_mach_service(_:_:_:_:))
- xpc_session_create_xpc_service(_:_:_:_:))
- xpc_session_copy_description(_:))
- xpc_session_set_target_queue(_:_:))
xpc_session_create_mach_service(_:_:_:_:)
Function | XPC
func xpc_session_create_mach_service(_ mach_service: UnsafePointer<CChar>, _ target_queue: dispatch_queue_t?, _ flags: xpc_session_create_flags_t, _ error_out: AutoreleasingUnsafeMutablePointer<xpc_rich_error_t?>?) -> (any OS_xpc_object)?
See Also
Creating a session
- xpc_session_t
- xpc_session_create_xpc_service(_:_:_:_:))
- xpc_session_create_flags_t
- xpc_session_copy_description(_:))
- xpc_session_set_target_queue(_:_:))
xpc_session_create_xpc_service(_:_:_:_:)
Function | XPC
func xpc_session_create_xpc_service(_ name: UnsafePointer<CChar>, _ target_queue: dispatch_queue_t?, _ flags: xpc_session_create_flags_t, _ error_out: AutoreleasingUnsafeMutablePointer<xpc_rich_error_t?>?) -> (any OS_xpc_object)?
See Also
Creating a session
- xpc_session_t
- xpc_session_create_mach_service(_:_:_:_:))
- xpc_session_create_flags_t
- xpc_session_copy_description(_:))
- xpc_session_set_target_queue(_:_:))
xpc_session_incoming_message_handler_t
Type Alias | XPC
typealias xpc_session_incoming_message_handler_t = (xpc_object_t) -> Void
See Also
Managing life cycle
- xpc_session_activate(_:_:))
- xpc_session_cancel(_:))
- xpc_session_set_cancel_handler(_:_:))
- xpc_session_set_incoming_message_handler(_:_:))
- xpc_session_cancel_handler_t
xpc_session_reply_handler_t
Type Alias | XPC
typealias xpc_session_reply_handler_t = (xpc_object_t?, xpc_rich_error_t?) -> Void
See Also
Sending messages
- xpc_rich_error_t
- xpc_rich_error_can_retry(_:))
- xpc_rich_error_copy_description(_:))
- xpc_session_send_message(_:_:))
- xpc_session_send_message_with_reply_async(_:_:_:))
- xpc_session_send_message_with_reply_sync(_:_:_:))
xpc_session_send_message(_:_:)
Function | XPC
func xpc_session_send_message(_ session: any OS_xpc_object, _ message: xpc_object_t) -> xpc_rich_error_t?
See Also
Sending messages
- xpc_rich_error_t
- xpc_rich_error_can_retry(_:))
- xpc_rich_error_copy_description(_:))
- xpc_session_send_message_with_reply_async(_:_:_:))
- xpc_session_reply_handler_t
- xpc_session_send_message_with_reply_sync(_:_:_:))
xpc_session_send_message_with_reply_async(_:_:_:)
Function | XPC
func xpc_session_send_message_with_reply_async(_ session: any OS_xpc_object, _ message: xpc_object_t, _ reply_handler: @escaping xpc_session_reply_handler_t)
See Also
Sending messages
- xpc_rich_error_t
- xpc_rich_error_can_retry(_:))
- xpc_rich_error_copy_description(_:))
- xpc_session_send_message(_:_:))
- xpc_session_reply_handler_t
- xpc_session_send_message_with_reply_sync(_:_:_:))
xpc_session_send_message_with_reply_sync(_:_:_:)
Function | XPC
func xpc_session_send_message_with_reply_sync(_ session: any OS_xpc_object, _ message: xpc_object_t, _ error_out: AutoreleasingUnsafeMutablePointer<xpc_rich_error_t?>?) -> xpc_object_t?
See Also
Sending messages
- xpc_rich_error_t
- xpc_rich_error_can_retry(_:))
- xpc_rich_error_copy_description(_:))
- xpc_session_send_message(_:_:))
- xpc_session_send_message_with_reply_async(_:_:_:))
- xpc_session_reply_handler_t
xpc_session_set_cancel_handler(_:_:)
Function | XPC
func xpc_session_set_cancel_handler(_ session: any OS_xpc_object, _ cancel_handler: @escaping xpc_session_cancel_handler_t)
See Also
Managing life cycle
- xpc_session_activate(_:_:))
- xpc_session_cancel(_:))
- xpc_session_set_incoming_message_handler(_:_:))
- xpc_session_incoming_message_handler_t
- xpc_session_cancel_handler_t
xpc_session_set_incoming_message_handler(_:_:)
Function | XPC
Sets a handler to receive incoming messages for a session.
func xpc_session_set_incoming_message_handler(_ session: any OS_xpc_object, _ handler: @escaping xpc_session_incoming_message_handler_t)
Parameters
- session: The session that receives messages.
- handler: A block that the session invokes when it receives messages.
See Also
Managing life cycle
- xpc_session_activate(_:_:))
- xpc_session_cancel(_:))
- xpc_session_set_cancel_handler(_:_:))
- xpc_session_incoming_message_handler_t
- xpc_session_cancel_handler_t
xpc_session_set_peer_code_signing_requirement(_:_:)
Function | XPC
func xpc_session_set_peer_code_signing_requirement(_ session: xpc_session_t, _ requirement: UnsafePointer<CChar>) -> Int32
xpc_session_set_target_queue(_:_:)
Function | XPC
func xpc_session_set_target_queue(_ session: any OS_xpc_object, _ target_queue: dispatch_queue_t?)
See Also
Creating a session
- xpc_session_t
- xpc_session_create_mach_service(_:_:_:_:))
- xpc_session_create_xpc_service(_:_:_:_:))
- xpc_session_create_flags_t
- xpc_session_copy_description(_:))
xpc_session_t
Type Alias | XPC
typealias xpc_session_t = OS_xpc_object
See Also
Creating a session
- xpc_session_create_mach_service(_:_:_:_:))
- xpc_session_create_xpc_service(_:_:_:_:))
- xpc_session_create_flags_t
- xpc_session_copy_description(_:))
- xpc_session_set_target_queue(_:_:))
none
Type Property | XPC
static let none: xpc_session_create_flags_t
inactive
Type Property | XPC
static let inactive: xpc_session_create_flags_t
privileged
Type Property | XPC
static let privileged: xpc_session_create_flags_t