AccessorySetupKit
Use the iOS 18+ system picker for privacy-preserving Bluetooth/Wi-Fi accessory discovery and authorization, then hand off communication to CoreBluetooth or NetworkExtension.
Contents
- Setup and Entitlements
- Discovery Descriptors
- Presenting the Picker
- Event Handling
- Bluetooth Accessories
- Wi-Fi Accessories
- Migration from CoreBluetooth
- Common Mistakes
- Review Checklist
- References
Setup and Entitlements
Info.plist Configuration
Add these keys to the app's Info.plist:
The Bluetooth-specific keys must match the values used in ASDiscoveryDescriptor.
If the app uses identifiers, names, or services not declared in Info.plist, the
app crashes during AccessorySetupKit discovery. For Wi-Fi accessories, include
WiFi in NSAccessorySetupSupports and match the descriptor's SSID rule.
No Bluetooth Permission Required
When an app declares NSAccessorySetupSupports with Bluetooth, creating a
CBCentralManager no longer triggers the system Bluetooth permission dialog.
The central manager's state transitions to poweredOn only when the app has
at least one paired accessory via AccessorySetupKit.
Discovery Descriptors
ASDiscoveryDescriptor defines the matching criteria for finding accessories.
The system matches scanned results against all rules in the descriptor to
filter for the target accessory.
Bluetooth Descriptor
A Bluetooth descriptor needs at least one of bluetoothCompanyIdentifier or
bluetoothServiceUUID. Add narrower matchers as needed:
bluetoothNameSubstringwith a company identifier or service UUIDbluetoothManufacturerDataBlobandbluetoothManufacturerDataMaskwith a company identifier; blob and mask must have the same lengthbluetoothServiceDataBlobandbluetoothServiceDataMaskwith a service UUID; blob and mask must have the same length
Wi-Fi Descriptor
Supply either ssid or ssidPrefix, not both. The app crashes if both are set.
The ssidPrefix must have a non-zero length.
Bluetooth Range
Control the physical proximity required for discovery:
Support Options
Set supportedOptions on the descriptor to declare the accessory's capabilities:
Presenting the Picker
Creating the Session
Create and activate an ASAccessorySession to manage discovery lifecycle. Wait for .activated before reading session.accessories or presenting the picker:
Showing the Picker
Create ASPickerDisplayItem instances with a name, product image, and
discovery descriptor, then pass them to the activated session:
The picker runs in a separate system process. It shows each matching device as a separate item. When multiple devices match a given descriptor, the picker creates a horizontal carousel.
Setup Options
Configure picker behavior per display item:
Product Images
The picker displays images in a 180x120 point container. Best practices:
- Use high-resolution images for all screen scale factors
- Use transparent backgrounds for correct light/dark mode appearance
- Adjust transparent borders as padding to control apparent accessory size
- Test in both light and dark mode
Event Handling
Event Types
The session delivers ASAccessoryEvent objects through the event handler:
Coordinating Picker Dismissal
When the user selects an accessory, .accessoryAdded fires before
.pickerDidDismiss. To show custom setup UI after the picker closes, store the
accessory on the first event and act on it after dismissal:
Bluetooth Accessories
After an accessory is added via the picker, use CoreBluetooth to communicate.
The bluetoothIdentifier on the ASAccessory maps to a CBPeripheral.
Key points:
CBCentralManagerstate reaches.poweredOnonly when the app has paired accessories- Scanning with
scanForPeripherals(withServices:)returns only accessories paired through AccessorySetupKit - No
NSBluetoothAlwaysUsageDescriptionis needed when using AccessorySetupKit exclusively
Wi-Fi Accessories
For Wi-Fi accessories, the ssid on the ASAccessory identifies the network.
Use NEHotspotConfiguration from NetworkExtension to join it:
Because the accessory was discovered through AccessorySetupKit, joining the network does not trigger the standard Wi-Fi access prompt.
Migration from CoreBluetooth
Apps with existing CoreBluetooth-authorized accessories can migrate them to
AccessorySetupKit using ASMigrationDisplayItem. This is a one-time operation
that registers known accessories in the new system.
Migration rules:
- If
showPickercontains only migration items, the system shows an informational page instead of a discovery picker - If migration items are mixed with regular display items, migration happens only when a new accessory is discovered and set up
- Do not initialize
CBCentralManagerbefore migration completes — doing so causes an error and the picker fails to appear - The session receives
.migrationCompletewhen migration finishes
Common Mistakes
Review Checklist
-
NSAccessorySetupSupportsadded to Info.plist withBluetoothand/orWiFi - Session activated before calling
showPicker - Event handler uses
[weak self]to avoid retain cycles - All
ASAccessoryEventTypecases handled, including@unknown default - Product images use transparent backgrounds and appropriate resolution
-
bluetoothIdentifierorssidfromASAccessoryused to connect post-setup - Accessory removal events handled to clean up app state
References
- Extended patterns (custom filtering, batch setup, removal handling, error recovery): references/accessorysetupkit-patterns.md [blocked]
- AccessorySetupKit framework
- ASAccessorySession
- ASDiscoveryDescriptor
- ASPickerDisplayItem
- ASAccessory
- ASAccessoryEvent
- ASMigrationDisplayItem
- Discovering and configuring accessories
- Setting up and authorizing a Bluetooth accessory
- Meet AccessorySetupKit — WWDC24


