<!--
{
  "availability" : [
    "macOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AccessoryAccess",
  "identifier" : "/documentation/AccessoryAccess/AAError/Code",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Accessory Access"
    ],
    "preciseIdentifier" : "c:@E@AAErrorCode"
  },
  "title" : "AAError.Code"
}
-->

# AAError.Code

Values that represent error codes that the AccessoryAccess framework returns.

```
enum Code
```

## Overview

The AccessoryAccess framework can also report errors from other domains when the error originates from a lower level component. The `NSError` domain for the AccessoryAccess framework is `AAErrorDomain`, the code is one of the `AAErrorCode` constants.

## Topics

### Error codes

[`case accessoryListenerAlreadyRegistered`](/documentation/AccessoryAccess/AAError/Code/accessoryListenerAlreadyRegistered)

An error code that indicates there’s already an accessory listener for the USB accessory.

[`case accessoryNotAccessible`](/documentation/AccessoryAccess/AAError/Code/accessoryNotAccessible)

An error code that indicates the USB accessory isn’t accessible since it may already be in use.

[`case internalError`](/documentation/AccessoryAccess/AAError/Code/internalError)

An error value that represents an internal error.

[`case invalidAccessoryState`](/documentation/AccessoryAccess/AAError/Code/invalidAccessoryState)

An error value that indicates the accessory isn’t in the correct state for the current operation.

### Creating an error code

[`init?(rawValue: Int)`](/documentation/AccessoryAccess/AAError/Code/init(rawValue:))

Creates a new error code with the provided value.

## Relationships

### Conforms To

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

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

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

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

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

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

---

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)