MCNearbyServiceAdvertiser
The MCNearbyServiceAdvertiser class publishes an advertisement for a specific service that your app provides through the Multipeer Connectivity framework and notifies its delegate about invitations from nearby peers.
Declaration
class MCNearbyServiceAdvertiserOverview
Before you can advertise a service, you must create an MCPeerID object that identifies your app and the user to nearby devices.
The serviceType parameter is a short text string used to describe the app’s networking protocol. It should be in the same format as a Bonjour service type: 1–15 characters long and valid characters include ASCII lowercase letters, numbers, and the hyphen, containing at least one letter and no adjacent hyphens. A short name that distinguishes itself from unrelated services is recommended; for example, a text chat app made by ABC company could use the service type "abc-txtchat". For more information about service types, read Domain Naming Conventions.
The discoveryInfo parameter is a dictionary of string key/value pairs that will be advertised for browsers to see. The content of discoveryInfo will be advertised within Bonjour TXT records, so you should keep the dictionary small for better discovery performance.
For more information about TXT records, read Bonjour Operations.