iOS Developer Library

Developer

MultipeerConnectivity Framework Reference MCNearbyServiceBrowserDelegate Protocol Reference

Options
Deployment Target:

On This Page
Language:

MCNearbyServiceBrowserDelegate

The MCNearbyServiceBrowserDelegate protocol defines methods that a MCNearbyServiceBrowser object’s delegate can implement to handle browser-related events.

Inheritance


Not Applicable

Import Statement


import MultipeerConnectivity @import MultipeerConnectivity;

Availability


Available in iOS 7.0 and later.
  • Called when a nearby peer is found. (required)

    Declaration

    Swift

    func browser(_ browser: MCNearbyServiceBrowser!, foundPeer peerID: MCPeerID!, withDiscoveryInfo info: [NSObject : AnyObject]!)

    Objective-C

    - (void)browser:(MCNearbyServiceBrowser *)browser foundPeer:(MCPeerID *)peerID withDiscoveryInfo:(NSDictionary *)info

    Parameters

    browser

    The browser object that found the nearby peer.

    peerID

    The unique ID of the peer that was found.

    info

    The info dictionary advertised by the discovered peer. For more information on the contents of this dictionary, see the documentation for initWithPeer:discoveryInfo:serviceType: in MCNearbyServiceAdvertiser Class Reference.

    Discussion

    The peer ID provided to this delegate method can be used to invite the nearby peer to join a session.

    Import Statement

    import MultipeerConnectivity

    Availability

    Available in iOS 7.0 and later.

  • Called when a nearby peer is lost. (required)

    Declaration

    Swift

    func browser(_ browser: MCNearbyServiceBrowser!, lostPeer peerID: MCPeerID!)

    Objective-C

    - (void)browser:(MCNearbyServiceBrowser *)browser lostPeer:(MCPeerID *)peerID

    Parameters

    browser

    The browser object that lost the nearby peer.

    peerID

    The unique ID of the nearby peer that was lost.

    Discussion

    This callback informs your app that invitations can no longer be sent to a peer, and that your app should remove that peer from its user interface.

    Import Statement

    import MultipeerConnectivity

    Availability

    Available in iOS 7.0 and later.