What's New / Connectivity & Hardware

What's new in MultipeerConnectivity

~13 DeprecatediOS · macOS · tvOS · visionOS

MultipeerConnectivity handles peer-to-peer discovery and data exchange between nearby devices over Wi-Fi and Bluetooth, without a router or internet connection. Apps advertise and browse for services, then send messages, streams, and resources between connected peers.

The 27 SDK adds and removes nothing; the change is 13 deprecations. These include the delegate protocols MCAdvertiserAssistantDelegate, MCBrowserViewControllerDelegate, and MCNearbyServiceAdvertiserDelegate, plus the error types MCErrorDomain, MCError, and MCError.Code.

Deprecated

13
let

kMCSessionMaximumNumberOfPeers

DeprecatediOSmacOStvOSvisionOS
public let kMCSessionMaximumNumberOfPeers: Int
DeprecatedUse Network Framework instead
let

kMCSessionMinimumNumberOfPeers

DeprecatediOSmacOStvOSvisionOS
public let kMCSessionMinimumNumberOfPeers: Int
DeprecatedUse Network Framework instead
protocol

MCAdvertiserAssistantDelegate

DeprecatediOSmacOStvOSvisionOS
public protocol MCAdvertiserAssistantDelegate : NSObjectProtocol
DeprecatedUse Network Framework instead
Declaration
public protocol MCAdvertiserAssistantDelegate : NSObjectProtocol {

    optional func advertiserAssistantWillPresentInvitation(_ advertiserAssistant: MCAdvertiserAssistant)

    optional func advertiserAssistantDidDismissInvitation(_ advertiserAssistant: MCAdvertiserAssistant)
}
protocol

MCBrowserViewControllerDelegate

DeprecatediOSmacOStvOSvisionOS
public protocol MCBrowserViewControllerDelegate : NSObjectProtocol
DeprecatedUse Network Framework instead
Declaration
public protocol MCBrowserViewControllerDelegate : NSObjectProtocol {

    func browserViewControllerDidFinish(_ browserViewController: MCBrowserViewController)

    func browserViewControllerWasCancelled(_ browserViewController: MCBrowserViewController)

    optional func browserViewController(_ browserViewController: MCBrowserViewController, shouldPresentNearbyPeer peerID: MCPeerID, withDiscoveryInfo info: [String : String]?) -> Bool
}
enum

MCEncryptionPreference

DeprecatediOSmacOStvOSvisionOS
public enum MCEncryptionPreference : Int, @unchecked Sendable
DeprecatedUse Network Framework instead
Declaration
public enum MCEncryptionPreference : Int, @unchecked Sendable {

    case optional = 0

    case required = 1

    case none = 2
}
struct

MCError

DeprecatediOSmacOStvOSvisionOS
public struct MCError : CustomNSError, Hashable, Error
DeprecatedUse Network Framework instead
Declaration
public struct MCError : CustomNSError, Hashable, Error {

    public init(_nsError: NSError)

    public static var errorDomain: String { get }

    @available(iOS, introduced: 7.0, deprecated: 27.0, message: "Use Network Framework instead")
    public enum Code : Int, @unchecked Sendable, Equatable {

        public typealias _ErrorType = MCError

        case unknown = 0

        case notConnected = 1

        case invalidParameter = 2

        case unsupported = 3

        case timedOut = 4

        case cancelled = 5

        case unavailable = 6
    }

    public static var unknown: MCError.Code { get }

    public static var notConnected: MCError.Code { get }

    public static var invalidParameter: MCError.Code { get }

    public static var unsupported: MCError.Code { get }

    public static var timedOut: MCError.Code { get }

    public static var cancelled: MCError.Code { get }

    public static var unavailable: MCError.Code { get }
}
let

MCErrorDomain

DeprecatediOSmacOStvOSvisionOS
public let MCErrorDomain: String
DeprecatedUse Network Framework instead
protocol

MCNearbyServiceAdvertiserDelegate

DeprecatediOSmacOStvOSvisionOS
public protocol MCNearbyServiceAdvertiserDelegate : NSObjectProtocol
DeprecatedUse Network Framework instead
Declaration
public protocol MCNearbyServiceAdvertiserDelegate : NSObjectProtocol {

    func advertiser(_ advertiser: MCNearbyServiceAdvertiser, didReceiveInvitationFromPeer peerID: MCPeerID, withContext context: Data?, invitationHandler: @escaping (Bool, MCSession?) -> Void)

    optional func advertiser(_ advertiser: MCNearbyServiceAdvertiser, didNotStartAdvertisingPeer error: any Error)
}
protocol

MCNearbyServiceBrowserDelegate

DeprecatediOSmacOStvOSvisionOS
public protocol MCNearbyServiceBrowserDelegate : NSObjectProtocol
DeprecatedUse Network Framework instead
Declaration
public protocol MCNearbyServiceBrowserDelegate : NSObjectProtocol {

    func browser(_ browser: MCNearbyServiceBrowser, foundPeer peerID: MCPeerID, withDiscoveryInfo info: [String : String]?)

    func browser(_ browser: MCNearbyServiceBrowser, lostPeer peerID: MCPeerID)

    optional func browser(_ browser: MCNearbyServiceBrowser, didNotStartBrowsingForPeers error: any Error)
}
protocol

MCSessionDelegate

DeprecatediOSmacOStvOSvisionOS
public protocol MCSessionDelegate : NSObjectProtocol
DeprecatedUse Network Framework instead
Declaration
public protocol MCSessionDelegate : NSObjectProtocol {

    func session(_ session: MCSession, peer peerID: MCPeerID, didChange state: MCSessionState)

    func session(_ session: MCSession, didReceive data: Data, fromPeer peerID: MCPeerID)

    func session(_ session: MCSession, didReceive stream: InputStream, withName streamName: String, fromPeer peerID: MCPeerID)

    func session(_ session: MCSession, didStartReceivingResourceWithName resourceName: String, fromPeer peerID: MCPeerID, with progress: Progress)

    func session(_ session: MCSession, didFinishReceivingResourceWithName resourceName: String, fromPeer peerID: MCPeerID, at localURL: URL?, withError error: (any Error)?)

    optional func session(_ session: MCSession, didReceiveCertificate certificate: [Any]?, fromPeer peerID: MCPeerID, certificateHandler: @escaping (Bool) -> Void)
}
enum

MCSessionSendDataMode

DeprecatediOSmacOStvOSvisionOS
public enum MCSessionSendDataMode : Int, @unchecked Sendable
DeprecatedUse Network Framework instead
Declaration
public enum MCSessionSendDataMode : Int, @unchecked Sendable {

    case reliable = 0

    case unreliable = 1
}
enum

MCSessionState

DeprecatediOSmacOStvOSvisionOS
public enum MCSessionState : Int, @unchecked Sendable
DeprecatedUse Network Framework instead
Declaration
public enum MCSessionState : Int, @unchecked Sendable {

    case notConnected = 0

    case connecting = 1

    case connected = 2
}
enum

MCError.Code

DeprecatediOSmacOStvOSvisionOS
public enum Code : Int, @unchecked Sendable, Equatable
DeprecatedUse Network Framework instead
Declaration
public enum Code : Int, @unchecked Sendable, Equatable {

    public typealias _ErrorType = MCError

    case unknown = 0

    case notConnected = 1

    case invalidParameter = 2

    case unsupported = 3

    case timedOut = 4

    case cancelled = 5

    case unavailable = 6
}

No APIs match your filter.

← More in Connectivity & Hardware