When I am toggling bluetooth while connected to a CoreBluetooth peripheral I do a disconnection and deletion of all references to my peripheral in the centralManagerDidUpdateState callback.
Doing another scan will find and reconnect to the device and again issue a discoverServices, but this time around the callback didDiscoverServices never happens. By deleting all settings (General -> Reset -> Reset all settings) or do a reboot it works again. Disconnect/reconnect as normal does also work. How can I work around this or delete all cache and UUID's stored by iOS programatically?
When you get the callback that the centralManager state has changed to CBCentralManagerStatePoweredOff, you need to loop through all your peripherals and call cancelConnection: on them. Then you'll be good to go.
[_yourCentralManager cancelPeripheralConnection:yourPeripheral];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With