CoreBluetooth connection issue (iOS 5.1.1)
CoreBluetooth connection issue (iOS 5.1.1)
- Subject: CoreBluetooth connection issue (iOS 5.1.1)
- From: Glenn Maynard <email@hidden>
- Date: Sat, 28 Jul 2012 14:21:16 -0500
If two apps connect to the same peripheral and the peripheral disconnects, CoreBluetooth seems to go into a bad state for the app that was suspended at the time of the disconnect.
1. App A is launched, and connects to a BLE peripheral (via retrievePeripherals+connectPeripheral).
2. App B is launched, which also connects to the same peripheral.
3. The peripheral is turned off (battery pull).
4. App B sees the disconnect normally. It calls connectDevice on the peripheral again, to go back to trying to connect. Nothing else happens; the device is powered off (normal behavior).
5. The user returns to app A. App A now also sees the device disconnect. It does the same thing, calling connectDevice.
App A now immediately receives didConnectPeripheral for the new CBPeripheral, even though the device is powered off. discoverServices then fails with CBErrorDomain error 0. This now happens forever for this peripheral, until the app is killed and restarted. Discarding the CBPeripheral and requesting a new one with another call to retrievePeripherals doesn't help. (Other peripherals are unaffected.)
This doesn't seem to happen with CBPeripherals received from didDiscoverPeripheral, but that requires turning on scanning (which interferes with wifi), so I'm trying to avoid that if I can. Any workarounds known?
--
Glenn Maynard
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Bluetooth-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden