CBConnectPeripheralOptionEnableAutoReconnect not working

Hi, I am trying to use the new parameter option CBConnectPeripheralOptionEnableAutoReconnect when connecting to a peripheral.
However I am receiving the error One or more parameters were invalid. I tested on iOS 17.1.

I try to connect using this code:

centralManager.connect(peripheral, options: [CBConnectPeripheralOptionEnableAutoReconnect: true])

Am I missing something? It looks like an iOS bug.

Answered by mateussilvapi in 771975022

SOLVED.

To use CBConnectPeripheralOptionEnableAutoReconnect we need to add the method centralManager(_:didDisconnectPeripheral:timestamp:isReconnecting:error:) on CBCentralManagerDelegate. It would be nice if the documentation mention that.

https://developer.apple.com/documentation/corebluetooth/cbcentralmanagerdelegate/4226852-centralmanager

Accepted Answer

SOLVED.

To use CBConnectPeripheralOptionEnableAutoReconnect we need to add the method centralManager(_:didDisconnectPeripheral:timestamp:isReconnecting:error:) on CBCentralManagerDelegate. It would be nice if the documentation mention that.

https://developer.apple.com/documentation/corebluetooth/cbcentralmanagerdelegate/4226852-centralmanager

CBConnectPeripheralOptionEnableAutoReconnect not working
 
 
Q