I've looked up and down for this problem, but no one seems to have it.
I have two iPads. One is acting as a Bluetooth peripheral that is always in the foreground. Since I am more interested in the central side, I have made my central iPad background-capable for BLE-central. My workflow is as follows:
When I run my central iPad app, steps 3 and 5 repeat every 10 seconds, even though the service is being advertised the entire time. This happens in the foreground and background.
On disconnect, I get this error:
Error occurred while disconnecting peripheral: The specified device has disconnected from us.
Any ideas on why it keeps disconnecting? Does CoreBluetooth clean up the connections if no data is being transferred? Right now, my central is doing a one-off read of peripheral characteristics. It is not subscribing to updates, since the values are static. Thanks!!
In my case the solution was to subscribe to the characteristic regardless of whether the value is static or not. It seems as though subscribing will keep the connection alive, whereas if you read one-off values the framework will try to conserve battery life and drop the connection, forcing you to manually reconnect before performing another read or write.
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