A listener that waits for new incoming connections, configures them, and accepts or rejects them.


@interface NSXPCListener : NSObject


Each XPC service, launchd agent, or launchd daemon typically has at least one NSXPCListener object that listens for connections to a specified service name. Each listener must have a delegate that conforms to the NSXPCListenerDelegate protocol. When the listener receives a new connection request, it creates a new NSXPCConnection object, then asks the delegate to inspect, configure, and resume the connection object by calling the delegate's listener:shouldAcceptNewConnection: method.



- initWithMachServiceName:

Initializes a listener in a LaunchAgent or LaunchDaemon which has a name advertised in a launchd.plist file.

Instance Properties


The delegate for the listener.


Returns an endpoint object that may be sent over an existing connection.

Instance Methods

- invalidate

Invalidates the listener.

- resume

Starts processing of incoming requests.

- suspend

Suspends the listener.

Type Methods

+ anonymousListener

Returns a new anonymous listener connection.

+ serviceListener

Returns the singleton listener used to listen for incoming connections in an XPC service.


Inherits From

See Also

XPC Services


The protocol that delegates to the XPC listener use to accept or reject new connections.


An object that names a specific XPC listener.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software