Class

NSXPCConnection

A bidirectional communication channel between two processes.

Declaration

@interface NSXPCConnection : NSObject

Overview

This class is the primary means of creating and configuring the communication mechanism between two processes. Each process has one instance of this class to represent the endpoint in the communication channel.

Topics

Creating Connections

- initWithListenerEndpoint:

Initializes an NSXPCConnection object to connect to an NSXPCListener object in another process, identified by an NSXPCListenerEndpoint object.

- initWithMachServiceName:options:

Initializes an NSXPCConnection object to connect to a LaunchAgent or LaunchDaemon with a name advertised in a launchd.plist.

NSXPCConnectionOptions

Options that you can pass to a connection.

- initWithServiceName:

Initializes an NSXPCConnection object to connect to an NSXPCListener object in an XPC service, identified by a service name.

Error Codes

NSXPCConnectionInterrupted

The XPC connection was interrupted.

NSXPCConnectionInvalid

The XPC connection was invalid.

NSXPCConnectionReplyInvalid

The XPC connection reply was invalid.

NSXPCConnectionErrorMinimum

The lower bounds of XPC connection error code values.

NSXPCConnectionErrorMaximum

The upper bounds of XPC connection error code values.

Instance Properties

auditSessionIdentifier

The BSM audit session identifier for the connecting process.

effectiveGroupIdentifier

The effective group ID (EGID) of the connecting process.

effectiveUserIdentifier

The effective user ID (EUID) of the connecting process.

endpoint

If the connection was created with an NSXPCListenerEndpoint object, returns the endpoint object used.

exportedInterface

The NSXPCInterface object that describes the protocol for the exported object on this connection.

exportedObject

An exported object for the connection.

interruptionHandler

An interruption handler that is called if the remote process exits or crashes.

invalidationHandler

An invalidation handler that is called if the connection can not be formed or the connection has terminated and may not be re-established.

processIdentifier

The process ID (PID) of the connecting process.

remoteObjectInterface

Defines the NSXPCInterface object that describes the protocol for the object represented by the remoteObjectProxy.

remoteObjectProxy

Returns a proxy for the remote object (that is, the exportedObject from the other side of this connection).

serviceName

The name of the XPC service that this connection was configured to connect to.

Instance Methods

- invalidate

Invalidates the connection.

- remoteObjectProxyWithErrorHandler:

Returns a proxy for the remote object (that is, the object exported from the other side of this connection) with the specified error handler.

- resume

Starts or resumes handling of messages on a connection.

- suspend

Suspends the connection.

Relationships

Inherits From

See Also

XPC Client

NSXPCProxyCreating

Methods for creating new proxy objects.

NSXPCInterface

An interface that may be sent to an exported object or remote object proxy.