We use iPhone to interact with a BLE device through Core Bluetooth framework. Everything works fine, except the Core Bluetooth will crash when we power off the device while iOS is still writing characteristic by calling
writeValue:forCharacteristic:type:
. The write type is CBCharacteristicWriteWithoutResponse
. In such circumstances we must reboot iPhone in order to connect to ANY BLE devices again, since turning off and on the bluetooth on iPhone is of no use.I have made some tests on this problem and get some information that when we power off the BLE device, iOS needs some time to get the disconnection event, so
writeValue:forCharacteristic:type:
is still being called at this period, this may cause the CoreBluetooth framework crash! I don't know why the BLE stack of iOS can't handle this.Any ideas on how to avoid such things when the device is out of power suddenly while iOS is still writing characteristic to it OR can
writeValue:forCharacteristic:type:
be called at some what safe manner?Thanks!