Instance Method

initWithPeer:

Creates a Multipeer Connectivity session.

Declaration

- (instancetype)initWithPeer:(MCPeerID *)myPeerID;

Parameters

myPeerID

A local identifier that represents the device on which your app is currently running.

Return Value

The initialized session object, or nil if an error occurs.

Discussion

This method is equivalent to calling initWithPeer:securityIdentity:encryptionPreference: with a nil identity and an encryption setting that varies based on which version of the SDK was used to link the application. On apps linked on or after iOS 9, the encryption is set to MCEncryptionRequired. On apps linked prior to iOS 9, the encryption is set to MCEncryptionOptional.

This method throws an exception if the provided peer ID object is invalid or nil.

For more information, see Initiating a Session.

See Also

Creating a Session

- initWithPeer:securityIdentity:encryptionPreference:

Creates a Multipeer Connectivity session, providing security information.

delegate

The delegate object that handles session-related events.

encryptionPreference

A value indicating whether the connection prefers encrypted connections, unencrypted connections, or has no preference.

myPeerID

A local identifier that represents the device on which your app is currently running.

securityIdentity

The security identity of the local peer.