Instance Method

session:peer:didChangeState:

Called when the state of a nearby peer changes.

Required.

Declaration

- (void)session:(MCSession *)session peer:(MCPeerID *)peerID didChangeState:(MCSessionState)state;

Parameters

session

The session that manages the nearby peer whose state changed.

peerID

The ID of the nearby peer whose state changed.

state

The new state of the nearby peer.

Discussion

This delegate method is called with the following state values when the nearby peer’s state changes:

  • MCSessionStateConnected—the nearby peer accepted the invitation and is now connected to the session.

  • MCSessionStateNotConnected—the nearby peer declined the invitation, the connection could not be established, or a previously connected peer is no longer connected.

See Also

MCSession Delegate Methods

- session:didReceiveData:fromPeer:

Indicates that an NSData object has been received from a nearby peer.

Required.

- session:didStartReceivingResourceWithName:fromPeer:withProgress:

Indicates that the local peer began receiving a resource from a nearby peer.

Required.

- session:didFinishReceivingResourceWithName:fromPeer:atURL:withError:

Indicates that the local peer finished receiving a resource from a nearby peer.

Required.

- session:didReceiveStream:withName:fromPeer:

Called when a nearby peer opens a byte stream connection to the local peer.

Required.

- session:didReceiveCertificate:fromPeer:certificateHandler:

Called to validate the client certificate provided by a peer when the connection is first established.