MCSession.ConnectPeer(MCPeerID, NSData) Method

Definition

Initiates a connection to a peer identified by peerID.

[Foundation.Export("connectPeer:withNearbyConnectionData:")]
public virtual void ConnectPeer (MultipeerConnectivity.MCPeerID peerID, Foundation.NSData data);
abstract member ConnectPeer : MultipeerConnectivity.MCPeerID * Foundation.NSData -> unit
override this.ConnectPeer : MultipeerConnectivity.MCPeerID * Foundation.NSData -> unit

Parameters

peerID
MCPeerID

The remote peer's identifier.

data
NSData
Attributes

Remarks

Application developers may use a non-Multipeer Connectivity discovery technique, such as Bonjour / NSNetService, and manually manage peer connection. However, the peerID used here and in NearbyConnectionDataForPeer(MCPeerID, MCSessionNearbyConnectionDataForPeerCompletionHandler) must originate from a NSKeyedArchiver serializing an MCPeerID on the remote peer. (This raises the question: if discovery and enough message-passing code to transmit the peerID is done by Bonjour, what's the advantage of using MPC for further communication? One answer might be the evolution of a legacy system, another answer might lie in the simpler message- and resource-passing of MPC.)

Applies to