NSNetServiceBrowserDelegate Protocol Reference

Conforms to
Framework
/System/Library/Frameworks/Foundation.framework
Availability
Available in iOS 4.0 and later.
Declared in
NSNetServices.h
Companion guides
Related sample code

Overview

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

Tasks

Using Network Service Browsers

Instance Methods

netServiceBrowser:didFindDomain:moreComing:

Tells the delegate the sender found a domain.

- (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

YES when netServiceBrowser is waiting for additional domains. NO 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 NO to do a bulk update of user interface elements.

Availability
  • Available in iOS 2.0 and later.
  • Available as part of an informal protocol prior to iOS 4.0.
See Also
Declared In
NSNetServices.h

netServiceBrowser:didFindService:moreComing:

Tells the delegate the sender found a service.

- (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

YES when netServiceBrowser is waiting for additional services. NO 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 NO 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 iOS 2.0 and later.
  • Available as part of an informal protocol prior to iOS 4.0.
See Also
Declared In
NSNetServices.h

netServiceBrowser:didNotSearch:

Tells the delegate that a search was not successful.

- (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.

Availability
  • Available in iOS 2.0 and later.
  • Available as part of an informal protocol prior to iOS 4.0.
Declared In
NSNetServices.h

netServiceBrowser:didRemoveDomain:moreComing:

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

- (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

YES when netServiceBrowser is waiting for additional domains. NO 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 NO to do a bulk update of user interface elements.

Availability
  • Available in iOS 2.0 and later.
  • Available as part of an informal protocol prior to iOS 4.0.
Declared In
NSNetServices.h

netServiceBrowser:didRemoveService:moreComing:

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

- (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

YES when netServiceBrowser is waiting for additional services. NO 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 NO to do a bulk update of user interface elements.

Availability
  • Available in iOS 2.0 and later.
  • Available as part of an informal protocol prior to iOS 4.0.
Declared In
NSNetServices.h

netServiceBrowserDidStopSearch:

Tells the delegate that a search was stopped.

- (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 iOS 2.0 and later.
  • Available as part of an informal protocol prior to iOS 4.0.
See Also
Declared In
NSNetServices.h

netServiceBrowserWillSearch:

Tells the delegate that a search is commencing.

- (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 iOS 2.0 and later.
  • Available as part of an informal protocol prior to iOS 4.0.
Declared In
NSNetServices.h