Creates a Multipeer Connectivity session, providing security information.
- iOS 7.0+
- macOS 10.10+
- Mac Catalyst 13.0+
- tvOS 10.0+
A local identifier that represents the device on which your app is currently running.
An array containing information that can be used to identify the local peer to other nearby peers.
The first object in this array should be a
Secobject that provides the local peer’s identity.
The remainder of the array should contain zero or more additional
Secobjects that provide any intermediate certificates that nearby peers might require when verifying the local peer’s identity. These certificates should be sent in certificate chain order.
When you add other peers to the session, those peers receive your local peer’s certificate (extracted from the provided identity) and any additional certificates that you provided. It is the receiving peer’s responsibility to validate that certificate, if desired.
An integer value that indicates whether encryption is required, preferred, or undesirable.
The initialized session object, or
nil if an error occurs.
All combinations of authentication (supplying an
identity value or not) and
encryption are legal. Using both authentication to establish a peer’s identity and encryption to secure the channel provides the most security, while using neither provides none, but the right combination depends upon the needs of your application. For example, one app might use authentication with unencrypted data if the source of the data must be established, but the data is not sensitive. Another app might use an unauthenticated but encrypted link to avoid eavesdropping among known peers.
This method throws an exception if the provided peer ID object is invalid or
For more information, see Initiating a Session.