CoreBluetooth does not report when peripheral devices disconnect.
| Originator: | kane.cheshire | ||
| Number: | rdar://24169259 | Date Originated: | 13-Jan-2016 04:26 PM |
| Status: | Closed | Resolved: | |
| Product: | OS X SDK | Product Version: | OS X 10.11.4 (15E27e) |
| Classification: | Reproducible: | Always |
Summary: In the current OS X 10.11.4 (15E27e) beta, CoreBluetooth no longer calls -centralManager:didDisconnectPeripheral:error: if a connected iOS device (acting as a CBPeripheral disconnects due to timeout or from turning off Bluetooth on the iOS device. This is a significant error and is reproducible on multiple machines running the OS X beta. This issue is not present in the current OS X public release (10.11.2) but has not been tested in OS X 10.11.3. Attached you will find a Bluetooth diagnostics report starting from when two iOS devices (running MacID com.kanecheshire.MacID) were connected as peripherals to MacID on the Mac (com.kanecheshire.MacIDOSX). One iOS device is running the latest public release of iOS 9, the other is running the current beta release of iOS 9.3. After turning off Bluetooth on both iOS devices, the CBCentralManagerDelegate on the Mac did not receive the -centralManager:didDisconnectPeripheral:error: delegate method. Interestingly, the -centralManager:didDisconnectPeripheral:error: *does* get called if you turn Bluetooth off on the Mac or if you disconnect a peripheral using the CBCentralManager instance method -cancelPeripheralConnection:, however calling that method does *not* work if the peripheral has already lost connection from its side, for example after turning off Bluetooth on the iOS device. Steps to Reproduce: 1. Set up an iOS app to act as a peripheral (CBPeripheralManager) 2. Set up an OS X app to act as a central, set the delegate and ensure -centralManager:didDisconnectPeripheral:error: is implemented (CBCentralManager) 3. Connect the iOS peripheral to the OS X central. 4. After a connection is sustained, turn off Bluetooth **on the iOS device**. 5. Note that -centralManager:didDisconnectPeripheral:error: never gets called on the CBCentralManagerDelegate Expected Results: -centralManager:didDisconnectPeripheral:error: should get called when the iOS app acting as a peripheral disconnects, either due to connection time outs or due to the user turning off Bluetooth on the peripheral. Actual Results: -centralManager:didDisconnectPeripheral:error: does not get called when the iOS app acting as a peripheral disconnects, either due to connection time outs or due to the user turning off Bluetooth on the peripheral. Version: OS X 10.11.4 (15E27e) Notes: I know you will try and I know you can't reply to this but please, please fix this before you release 10.11.4. This is a significant issue which could break tonnes and tonnes of apps. Configuration: iPhone 5S running iOS 9.3 beta iPhone 6S Plus running iOS 9.2 MacBook Pro Retina (mid-2012) running OS X 10.11.4 (15E27e) MacBook Pro Retain (mid-2015) running OS X 10.11.4 (15E27e)
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!