Contents

close(completionHandler:)

Closes all connections to the USB accessory for this process.

Declaration

func close(completionHandler: @escaping  @Sendable ((any Error)?) -> Void)
func close() async throws

Parameters

  • completionHandler:

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

Discussion

This operation closes the USB accessory, that the app previously opened through open(serviceQueue:completionHandler:). Once this operation completes, the framework invalidates any IOUSBHostDevice object it previously returned and you can’t use it for USB transfers. This operation has the same effect as calling the destroy method on IOUSBHostDevice.

Once the app closes the accessory, the app can re-open the accessory using this process or any other worker process of this client application for exclusive access using open(serviceQueue:completionHandler:).

See Also

Managing a USB accessory