Mac Developer Library

Developer

Foundation Framework Reference NSXPCListenerDelegate Protocol Reference

Options
Deployment Target:

On This Page
Language:

NSXPCListenerDelegate

Inheritance


Not Applicable

Conforms To


Import Statement


Swift

import Foundation

Objective-C

@import Foundation;

Availability


Available in OS X v10.8 and later.

Protocol for delegates to the NSXPC listener class that allows you to accept or reject new connections to the listener.

  • Accepts or rejects a new connection to the listener.

    Declaration

    Swift

    optional func listener(_ listener: NSXPCListener, shouldAcceptNewConnection newConnection: NSXPCConnection) -> Bool

    Objective-C

    - (BOOL)listener:(NSXPCListener *)listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection

    Discussion

    To accept the connection, first configure the connection if desired, then call resume on the new connection, then return YEStrue.

    To reject the connect, return a value of NOfalse. This causes the connection object to be invalidated.

    In this method, you can also set up properties on the connection object, such as its exported object and interfaces. Be sure to call resume when you are finished configuring the connection object and are ready for it to receive messages.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.8 and later.