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.

  • Tells the delegate the sender found a domain.

    Declaration

    Swift

    optional func netServiceBrowser(_ browser: NSNetServiceBrowser, didFindDomain domainString: String, moreComing moreComing: 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.

    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(_ browser: NSNetServiceBrowser, didRemoveDomain domainString: String, moreComing moreComing: 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.

    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(_ browser: NSNetServiceBrowser, didFindService service: NSNetService, moreComing moreComing: 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.

    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(_ browser: NSNetServiceBrowser, didRemoveService service: NSNetService, moreComing moreComing: 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.

    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(_ browser: 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.

    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(_ browser: NSNetServiceBrowser, didNotSearch errorDict: [String : NSNumber])

    Objective-C

    - (void)netServiceBrowser:(NSNetServiceBrowser *)netServiceBrowser didNotSearch:(NSDictionary<NSString *,NSNumber *> *)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.

    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(_ browser: 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.

    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)