<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AccessorySetupKit",
  "identifier" : "/documentation/AccessorySetupKit/ASAccessorySession",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AccessorySetupKit"
    ],
    "preciseIdentifier" : "c:objc(cs)ASAccessorySession"
  },
  "title" : "ASAccessorySession"
}
-->

# ASAccessorySession

A class to coordinate accessory discovery.

```
class ASAccessorySession
```

## Overview

Use an instance of `ASAccessorySession` to interact with the AccessorySetupKit framework.

Start the session by calling [`activate(on:eventHandler:)`](/documentation/AccessorySetupKit/ASAccessorySession/activate(on:eventHandler:)), and pass in a dispatch queue and an event-handling closure.
AccessorySetupKit calls back to your event handler as the discovery session processes events.

With your event-handler prepared, create an array of [`ASPickerDisplayItem`](/documentation/AccessorySetupKit/ASPickerDisplayItem) instances to describe accessories your app can set up.
Pass this array to the session’s [`showPicker(for:completionHandler:)`](/documentation/AccessorySetupKit/ASAccessorySession/showPicker(for:completionHandler:)) method to allow someone using your app to choose a discovered accessory to set up.
Your event handler receives events as the picker appears and dismisses, as well as when the person using the app adds an accessory.

> Important: Starting in iOS 18.4, apps can use AccessorySetupKit for discovery and setup of Bluetooth LE devices that conform to the Human Interface Device (HID) service, such as keyboard and mouse accessories. The HID accessory needs to advertise a custom service besides the HID service. Add the ``doc://com.apple.AccessorySetupKit/documentation/AccessorySetupKit/ASAccessory/SupportOptions/bluetoothHID`` option to the ``doc://com.apple.AccessorySetupKit/documentation/AccessorySetupKit/ASDiscoveryDescriptor/supportedOptions`` and configure the ``doc://com.apple.AccessorySetupKit/documentation/AccessorySetupKit/ASDiscoveryDescriptor`` to discover the custom service instead of the HID service.

## Topics

### Managing the session life cycle

[`-  activateWithQueue:eventHandler:`](/documentation/AccessorySetupKit/ASAccessorySession/activate(on:eventHandler:))

Activate the session and start delivering events to an event handler.

[`-  invalidate`](/documentation/AccessorySetupKit/ASAccessorySession/invalidate())

Invalidate the session by stopping any operations.

### Displaying an accessory picker

[`-  showPickerWithCompletionHandler:`](/documentation/AccessorySetupKit/ASAccessorySession/showPicker(completionHandler:))

Present a picker that shows accessories managed by a Device Discovery Extension in your app.

[`-  showPickerForDisplayItems:completionHandler:`](/documentation/AccessorySetupKit/ASAccessorySession/showPicker(for:completionHandler:))

Present a picker that shows discovered accessories matching an array of display items.

### Customizing picker behavior

[`pickerDisplaySettings`](/documentation/AccessorySetupKit/ASAccessorySession/pickerDisplaySettings)

Settings that affect the display of the accessory picker.

[`ASPickerDisplaySettings`](/documentation/AccessorySetupKit/ASPickerDisplaySettings)

A type that contains settings to customize the display of the accessory picker

### Updating the picker

[`-  updatePickerShowingDiscoveredDisplayItems:completionHandler:`](/documentation/AccessorySetupKit/ASAccessorySession/updatePicker(showing:completionHandler:))

Updates the picker with app-filtered accessories.

### Ending filtered discovery

[`-  finishPickerDiscovery:`](/documentation/AccessorySetupKit/ASAccessorySession/finishPickerDiscovery(completionHandler:))

Finish the discovery session in the picker and show a timeout error.

### Accessing discovered accessories

[`accessories`](/documentation/AccessorySetupKit/ASAccessorySession/accessories)

An array of previously-selected accessories for this application.

### Managing accessories

[`-  renameAccessory:options:completionHandler:`](/documentation/AccessorySetupKit/ASAccessorySession/renameAccessory(_:options:completionHandler:))

Displays a view to rename an accessory.

[`RenameOptions`](/documentation/AccessorySetupKit/ASAccessory/RenameOptions)

Options that affect the behavior of an accessory renaming operation.

[`-  removeAccessory:completionHandler:`](/documentation/AccessorySetupKit/ASAccessorySession/removeAccessory(_:completionHandler:))

Removes an accessory.

### Managing authorization

[`-  finishAuthorization:settings:completionHandler:`](/documentation/AccessorySetupKit/ASAccessorySession/finishAuthorization(for:settings:completionHandler:))

Finish authorization of a partially-setup accessory.

[`ASAccessorySettings`](/documentation/AccessorySetupKit/ASAccessorySettings)

Properties of an accessory.

[`-  failAuthorization:completionHandler:`](/documentation/AccessorySetupKit/ASAccessorySession/failAuthorization(for:completionHandler:))

End authorization of a partially-configured accessory as a failure.

[`-  updateAuthorization:descriptor:completionHandler:`](/documentation/AccessorySetupKit/ASAccessorySession/updateAuthorization(for:descriptor:completionHandler:))

Displays a view to upgrade an accessory with additional technology permissions.

## Relationships

### Conforms To

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

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

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

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

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

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

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

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

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)