I am developing an app that communicates with external BLE device over GATT. The device has a secure-read characteristic exposing some of it's data and requires pairing/bonding in order to communicate with it.
I was able to pair and connect with the device using AccessorySetupKit and .bluetoothPairingLE option:
let descriptor = ASDiscoveryDescriptor()
descriptor.bluetoothServiceUUID = CBUUID(string: serviceUUID)
descriptor.supportedOptions = [.bluetoothPairingLE]
let picketItem = ASPickerDisplayItem(name: name, productImage: image, descriptor: descriptor)
In this case when setting up accessory, I was prompted to compare passkeys and after confirming I can read the characteristic etc.
Then I tried adding .confirmAuthorization
to picker item and problems started:
let descriptor = ASDiscoveryDescriptor()
descriptor.bluetoothServiceUUID = CBUUID(string: serviceUUID)
descriptor.supportedOptions = [.bluetoothPairingLE]
let picketItem = ASPickerDisplayItem(name: name, productImage: image, desc
pickerItem.setupOptions = [.confirmAuthorization]
When setting up, I can see a passkey to be confirmed, but when confirmed the setup ui get's suck in loading state. Under the hood in logs, I can see that my app has connected to peripheral and was able to read the characteristic.
I am unsure why the ui is stuck in loading state in this case. What is the difference when using .confirmAuthorization
option and what should be the proper flow of events to setup accessory and then access protoected characteristic?