<!--
{
  "availability" : [
    "iOS: 7.0.0 - 27.0.0",
    "iPadOS: 7.0.0 - 27.0.0",
    "macCatalyst: 13.1.0 - 27.0.0",
    "macOS: 10.10.0 - 27.0.0",
    "tvOS: 10.0.0 - 27.0.0",
    "visionOS: 1.0.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "MultipeerConnectivity",
  "identifier" : "/documentation/MultipeerConnectivity/MCError/Code",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Multipeer Connectivity"
    ],
    "preciseIdentifier" : "c:@E@MCErrorCode"
  },
  "title" : "MCError.Code"
}
-->

# MCError.Code

Error codes found in [`MCErrorDomain`](/documentation/MultipeerConnectivity/MCErrorDomain) error domain `NSError` objects returned by methods in the Multipeer Connectivity framework.

```
enum Code
```

## Topics

### Constants

[`case unknown`](/documentation/MultipeerConnectivity/MCError/Code/unknown)

An unknown error occurred.

[`case notConnected`](/documentation/MultipeerConnectivity/MCError/Code/notConnected)

Your app attempted to send data to a peer that is not connected.

[`case invalidParameter`](/documentation/MultipeerConnectivity/MCError/Code/invalidParameter)

Your app passed an invalid value as a parameter.

[`case unsupported`](/documentation/MultipeerConnectivity/MCError/Code/unsupported)

The operation is unsupported. For example, this error is returned if you call [`sendResource(at:withName:toPeer:withCompletionHandler:)`](/documentation/MultipeerConnectivity/MCSession/sendResource(at:withName:toPeer:withCompletionHandler:)) with a URL that is neither a local file nor a web URL.

[`case timedOut`](/documentation/MultipeerConnectivity/MCError/Code/timedOut)

The connection attempt timed out.

[`case cancelled`](/documentation/MultipeerConnectivity/MCError/Code/cancelled)

The operation was cancelled by the user.

[`case unavailable`](/documentation/MultipeerConnectivity/MCError/Code/unavailable)

Multipeer connectivity is currently unavailable.

### Initializers

[`init?(rawValue: Int)`](/documentation/MultipeerConnectivity/MCError/Code/init(rawValue:))

## Relationships

### Conforms To

[`Hashable`](/documentation/Swift/Hashable)

[`RawRepresentable`](/documentation/Swift/RawRepresentable)

[`Sendable`](/documentation/Swift/Sendable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Equatable`](/documentation/Swift/Equatable)

[`BitwiseCopyable`](/documentation/Swift/BitwiseCopyable)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)