I am making an iOS application with Core Bluetooth. My device has a central role, and several other iOS peripherals have several characteristics. Peripheral features include 1 Read, 2 Notify, and Write. I am using the "Invalid Handle" error to characterize Read in the delegate callback didUpdateValueForCharacteristic. If I ignore the error and display the value of the characteristics, it works fine. However, when I go to write to the Write characteristic, I get a "Handle is invalid" error in the delegate callback didWriteValueForCharacteristic. I can't just ignore this error because I checked that the peripheral device that I am writing about is not actually written.
I know that I can solve this problem by manually resetting Bluetooth on any of the iOS devices (peripheral or central). And I do not know how to systematically recreate this error. This happens by chance, but it is not uncommon.
Does anyone have an idea of ββthe cause of this problem? Or a possible workaround? Even a way to programmatically simulate a Bluetooth reset?
source
share