Returns the receiver, initialized as a network service of a given type and sets the initial host information.
- iOS 2.0+
- macOS 10.2+
- Mac Catalyst 13.0+
- tvOS 9.0+
The domain for the service. To resolve in the default domains, pass in an empty string (
@""). To limit resolution to the local domain, use
If you are creating this object to resolve a service whose information your app stored previously, you should set this to the domain in which the service was originally discovered.
You can also use a
NSNetobject to obtain a list of possible domains in which you can discover and resolve services.
The network service type.
typemust contain both the service type and transport layer information. To ensure that the mDNS responder searches for services, as opposed to hosts, prefix both the service name and transport layer name with an underscore character (“_”). For example, to search for an HTTP service on TCP, you would use the type string "
_http". Note that the period character at the end of the string, which indicates that the domain name is an absolute name, is required.
The name of the service to resolve.
The receiver, initialized as a network service named
name of type
type in the domain
This method is the appropriate initializer to use to resolve a service—to publish a service, use
If you know the values for
name of the service you wish to connect to, you can create an
NSNet object using this initializer and call
resolve on the result.
You cannot use this initializer to publish a service. This initializer passes an invalid port number to the designated initializer, which prevents the service from being registered. Calling
publish on an
NSNet object initialized with this method generates a call to your delegate’s
net method with an