<!--
{
  "availability" : [
    "macCatalyst: 14.0.0 -",
    "macOS: 10.15.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "IOUSBHost",
  "identifier" : "/documentation/IOUSBHost/IOUSBHostObject/initWithIOService:options:queue:error:interestHandler:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "IOUSBHost"
    ],
    "preciseIdentifier" : "c:objc(cs)IOUSBHostObject(im)initWithIOService:options:queue:error:interestHandler:"
  },
  "title" : "initWithIOService:options:queue:error:interestHandler:"
}
-->

# initWithIOService:options:queue:error:interestHandler:

Creates a USB host object and sets up a communication channel to the kernel.

```
- (instancetype) initWithIOService:(io_service_t) ioService options:(IOUSBHostObjectInitOptions) options queue:(dispatch_queue_t) queue error:(NSError **) error interestHandler:(IOUSBHostInterestHandler) interestHandler;
```

## Parameters

`ioService`

The service type of the [`IOUSBHostDevice`](/documentation/IOUSBHost/IOUSBHostDevice) or [`IOUSBHostInterface`](/documentation/IOUSBHost/IOUSBHostInterface). The [`IOUSBHostObject`](/documentation/IOUSBHost/IOUSBHostObject) keeps a reference to the service type and releases it during [`destroy()`](/documentation/IOUSBHost/IOUSBHostObject/destroy()).

`options`

Optional arguments for initializing the object. The default value is [`IOUSBHostObjectInitOptionsNone`](/documentation/IOUSBHost/IOUSBHostObjectInitOptions/IOUSBHostObjectInitOptionsNone).

`queue`

A serial dispatch queue for servicable asynchronous input/output requests. By default, this method creates a serial queue on behalf of the client.

`error`

An <doc://com.apple.documentation/documentation/Foundation/NSError> that contains an <doc://com.apple.documentation/documentation/kernel/ioreturn> value on failure.

`interestHandler`

A callback for managing internal device-state changes, such as termination.

## Return Value

An [`IOUSBHostObject`](/documentation/IOUSBHost/IOUSBHostObject) instance, or `nil` on failure.

## Discussion

If the kernel <doc://com.apple.documentation/documentation/kernel/iousbhostdevice> or [`IOUSBHostInterface`](/documentation/IOUSBHost/IOUSBHostInterface) is already open for exclusive access, the method returns `nil`. The method establishes exclusive ownership of the <doc://com.apple.documentation/documentation/kernel/io_service_t>.

> Important:
> When done with the object, call ``doc://com.apple.iousbhost/documentation/IOUSBHost/IOUSBHostObject/destroy()``.

## Topics

### Interest Handler

[`IOUSBHostInterestHandler`](/documentation/IOUSBHost/IOUSBHostInterestHandler)

The callback that handles underlying service-state changes.



---

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)