Mac Developer Library

Developer

Foundation Framework Reference NSNetServiceBrowserDelegate Protocol Reference

Options
Deployment Target:

On This Page
Language:

NSNetServiceBrowserDelegate

The NSNetServiceBrowserDelegate protocol defines the optional methods implemented by delegates of NSNetServiceBrowser objects.

Inheritance


Not Applicable

Import Statement


Swift

import Foundation

Objective-C

@import Foundation;

Availability


Available in OS X v10.6 and later.
  • Tells the delegate the sender found a domain.

    Declaration

    Swift

    optional func netServiceBrowser(_ netServiceBrowser: NSNetServiceBrowser, didFindDomain domainName: String, moreComing moreDomainsComing: Bool)

    Objective-C

    - (void)netServiceBrowser:(NSNetServiceBrowser *)netServiceBrowser didFindDomain:(NSString *)domainName moreComing:(BOOL)moreDomainsComing

    Parameters

    netServiceBrowser

    Sender of this delegate message.

    domainName

    Name of the domain found by netServiceBrowser.

    moreDomainsComing

    YEStrue when netServiceBrowser is waiting for additional domains. NOfalse when there are no additional domains.

    Discussion

    The delegate uses this message to compile a list of available domains. It should wait until moreDomainsComing is NOfalse to do a bulk update of user interface elements.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.2 and later.

    Available as part of an informal protocol prior to OS X v10.6.

    See Also

    – searchForBrowsableDomains (NSNetServiceBrowser)
    – searchForRegistrationDomains (NSNetServiceBrowser)

  • Tells the delegate the a domain has disappeared or has become unavailable.

    Declaration

    Swift

    optional func netServiceBrowser(_ netServiceBrowser: NSNetServiceBrowser, didRemoveDomain domainName: String, moreComing moreDomainsComing: Bool)

    Objective-C

    - (void)netServiceBrowser:(NSNetServiceBrowser *)netServiceBrowser didRemoveDomain:(NSString *)domainName moreComing:(BOOL)moreDomainsComing

    Parameters

    netServiceBrowser

    Sender of this delegate message.

    domainName

    Name of the domain that became unavailable.

    moreDomainsComing

    YEStrue when netServiceBrowser is waiting for additional domains. NOfalse when there are no additional domains.

    Discussion

    The delegate uses this message to compile a list of unavailable domains. It should wait until moreDomainsComing is NOfalse to do a bulk update of user interface elements.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.2 and later.

    Available as part of an informal protocol prior to OS X v10.6.

  • Tells the delegate the sender found a service.

    Declaration

    Swift

    optional func netServiceBrowser(_ netServiceBrowser: NSNetServiceBrowser, didFindService netService: NSNetService, moreComing moreServicesComing: Bool)

    Objective-C

    - (void)netServiceBrowser:(NSNetServiceBrowser *)netServiceBrowser didFindService:(NSNetService *)netService moreComing:(BOOL)moreServicesComing

    Parameters

    netServiceBrowser

    Sender of this delegate message.

    netService

    Network service found by netServiceBrowser. The delegate can use this object to connect to and use the service.

    moreServicesComing

    YEStrue when netServiceBrowser is waiting for additional services. NOfalse when there are no additional services.

    Discussion

    The delegate uses this message to compile a list of available services. It should wait until moreServicesComing is NOfalse to do a bulk update of user interface elements.

    Special Considerations

    If the delegate chooses to resolve netService, it should retain netService and set itself as that service’s delegate. The delegate should, therefore, release that service when it receives the netServiceDidResolveAddress: or netService:didNotResolve: delegate messages of the NSNetService class.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.2 and later.

    Available as part of an informal protocol prior to OS X v10.6.

    See Also

    – searchForServicesOfType:inDomain: (NSNetServiceBrowser)

  • Tells the delegate a service has disappeared or has become unavailable.

    Declaration

    Swift

    optional func netServiceBrowser(_ netServiceBrowser: NSNetServiceBrowser, didRemoveService netService: NSNetService, moreComing moreServicesComing: Bool)

    Objective-C

    - (void)netServiceBrowser:(NSNetServiceBrowser *)netServiceBrowser didRemoveService:(NSNetService *)netService moreComing:(BOOL)moreServicesComing

    Parameters

    netServiceBrowser

    Sender of this delegate message.

    netService

    Network service that has become unavailable.

    moreServicesComing

    YEStrue when netServiceBrowser is waiting for additional services. NOfalse when there are no additional services.

    Discussion

    The delegate uses this message to compile a list of unavailable services. It should wait until moreServicesComing is NOfalse to do a bulk update of user interface elements.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.2 and later.

    Available as part of an informal protocol prior to OS X v10.6.

  • Tells the delegate that a search is commencing.

    Declaration

    Swift

    optional func netServiceBrowserWillSearch(_ netServiceBrowser: NSNetServiceBrowser)

    Objective-C

    - (void)netServiceBrowserWillSearch:(NSNetServiceBrowser *)netServiceBrowser

    Parameters

    netServiceBrowser

    Sender of this delegate message.

    Discussion

    This message is sent to the delegate only if the underlying network layer is ready to begin a search. The delegate can use this notification to prepare its data structures to receive data.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.2 and later.

    Available as part of an informal protocol prior to OS X v10.6.

  • Tells the delegate that a search was not successful.

    Declaration

    Swift

    optional func netServiceBrowser(_ netServiceBrowser: NSNetServiceBrowser, didNotSearch errorInfo: [NSObject : AnyObject])

    Objective-C

    - (void)netServiceBrowser:(NSNetServiceBrowser *)netServiceBrowser didNotSearch:(NSDictionary *)errorInfo

    Parameters

    netServiceBrowser

    Sender of this delegate message.

    errorInfo

    Dictionary with the reasons the search was unsuccessful. Use the dictionary keys NSNetServicesErrorCode and NSNetServicesErrorDomain to retrieve the error information from the dictionary.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.2 and later.

    Available as part of an informal protocol prior to OS X v10.6.

  • Tells the delegate that a search was stopped.

    Declaration

    Swift

    optional func netServiceBrowserDidStopSearch(_ netServiceBrowser: NSNetServiceBrowser)

    Objective-C

    - (void)netServiceBrowserDidStopSearch:(NSNetServiceBrowser *)netServiceBrowser

    Parameters

    netServiceBrowser

    Sender of this delegate message.

    Discussion

    When netServiceBrowser receives a stop message from its client, netServiceBrowser sends a netServiceBrowserDidStopSearch: message to its delegate. The delegate then performs any necessary cleanup.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.2 and later.

    Available as part of an informal protocol prior to OS X v10.6.

    See Also

    – stop (NSNetServiceBrowser)