init(peer:)
Creates a Multipeer Connectivity session.
Declaration
convenience init(peer myPeerID: MCPeerID)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 init(peer: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 MCEncryptionPreference.required. On apps linked prior to iOS 9, the encryption is set to MCEncryptionPreference.optional.
This method throws an exception if the provided peer ID object is invalid or nil.
For more information, see Initiating a Session.