<!--
{
  "availability" : [
    "macOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AccessoryAccess",
  "identifier" : "/documentation/AccessoryAccess/AAUSBAccessory/open(serviceQueue:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Accessory Access"
    ],
    "preciseIdentifier" : "c:objc(cs)AAUSBAccessory(im)openWithServiceQueue:completionHandler:"
  },
  "title" : "open(serviceQueue:completionHandler:)"
}
-->

# open(serviceQueue:completionHandler:)

Opens a connection to the USB accessory for this process to access it exclusively.

```
func open(serviceQueue: dispatch_queue_t?, completionHandler: @escaping @Sendable (IOUSBHostDevice, (any Error)?) -> Void)
```

```
func open(serviceQueue: dispatch_queue_t?) async throws -> IOUSBHostDevice
```

## Parameters

`serviceQueue`

A serial queue that the app uses to service all the asynchronous requests it submits to the default control endpoint. By default the framework creates an internal serial queue for the client process.

`completionHandler`

The block the framework calls after the client has successfully opened the USB accessory. The error parameter passed to the block is `nil` if the operation was successful. The framework invokes the block on an arbitrary thread.

## Discussion

This operation opens a connection to the USB accessory for exclusive access and returns its <doc://com.apple.documentation/documentation/IOUSBHost/IOUSBHostDevice> object. An app can call this multiple times, subsequent calls will return the same `IOUSBHostDevice` instance.

When the process no longer needs exclusive access to this accessory, call [`close(completionHandler:)`](/documentation/AccessoryAccess/AAUSBAccessory/close(completionHandler:)) to close the accessory. This will close all open connections to the accessory and invalidate all the IOUSBHostDevice objects.

---

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)