<!--
{
  "availability" : [
    "macCatalyst: 14.0.0 -",
    "macOS: 10.15.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "IOUSBHost",
  "identifier" : "/documentation/IOUSBHost/IOUSBHostPipe/enqueueIORequest(with:completionTimeout:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "IOUSBHost"
    ],
    "preciseIdentifier" : "c:objc(cs)IOUSBHostPipe(im)enqueueIORequestWithData:completionTimeout:error:completionHandler:"
  },
  "title" : "enqueueIORequest(with:completionTimeout:completionHandler:)"
}
-->

# enqueueIORequest(with:completionTimeout:completionHandler:)

Enqueues an input/output request on the pipe.

```
func enqueueIORequest(with data: NSMutableData?, completionTimeout: TimeInterval, completionHandler: (@Sendable (IOReturn, Int) -> Void)? = nil) throws
```

## Parameters

`data`

An <doc://com.apple.documentation/documentation/Foundation/NSMutableData> object defining the memory to use for the transfer. Use <doc://com.apple.documentation/documentation/ObjectiveC/nil-227m0> to send a zero-length packet.

`completionTimeout`

A <doc://com.apple.documentation/documentation/Foundation/TimeInterval> value representing the timeout of the request. If `0`, the request never times out. Use [`IOUSBHostDefaultControlCompletionTimeout`](/documentation/IOUSBHost/IOUSBHostDefaultControlCompletionTimeout) unless there’s a need for a specific timeout.

`completionHandler`

An [`IOUSBHostCompletionHandler`](/documentation/IOUSBHost/IOUSBHostCompletionHandler) that runs when the request completes, or times out after the call returns successfully. If the method returns with an error, the completion handler doesn’t run.

## Return Value

`YES` if the request completes successfully; otherwise, `NO`.

## Discussion

> Important:
> You can call this method from synchronous code using a completion handler, as shown on this page, or you can call it as an asynchronous method that has the following declaration:
> 
> ```swift
> func enqueueIORequest(with data: NSMutableData?, completionTimeout: TimeInterval) async throws -> (IOReturn, Int)
> ```
> 
> For information about concurrency and asynchronous code in Swift, see <doc://com.apple.documentation/documentation/Swift/calling-objective-c-apis-asynchronously>.

Use this method to issue an asynchronous input/output request on a bulk or interrupt pipe.

---

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)