didDiscoverServices never called on iPad Pro(iOS9.x) when connecting 4th peripheral

Originator:hironand
Number:rdar://28838317 Date Originated:19-Oct-2016 11:58 AM
Status:Closed Resolved:05-Dec-2016 00:08 AM
Product:iOS + SDK Product Version:iOS 9.3.5
Classification:Bluetooth Reproducible:Always
 
Area:
Bluetooth

Summary:
I have developed CoreBluetooth App which is composed of iOS (central) and multiple BLE devices (peripheral).
I have debugged it on `iPhone6 plus` and it has worked fine.
But running on iPad Pro, it hasn’t worked correctly.
After Connected and communicated to 3rd peripheral and connected 4th peripheral, called method `CBPeripheral#discoverServices` to communicate to 4th peripheral, but delegate method `peripheral:didDiscoverServices:error` was never called.
After waited several minues,  method `centralManager:didDisconnectPeripheral:error` was called with an error `"Domain=CBErrorDomain Code=0” Unknown error`.
So, peripheral state turned to disconnected.

I've been annoyed and didn’t understand why this had occurred, and found a similar bug report:
http://openradar.appspot.com/28479978

In above case, issue occurred on iPhone 7, but in this case, device is iPad Pro and first three BLE device were connceted and communicated correctly, but regardless of conneting order, delegate method `peripheral:didDiscoverServices`  doesn’t be called.

In addition, also tried calling `CBCentralManager#cancelPeripheralConnection` before connecting to peripheral to clear connecting caches of iOS CoreBluetooth, but didn’t work either.
see also:
http://stackoverflow.com/questions/12004623/iphone-does-not-discover-services-on-a-bluetooth-le-tag-on-reconnection

Steps to Reproduce:
On iPad Pro (4th connection later) [FAILS]
1) `CBCentralManager -scanForPeripheralsWithServices:nil options:nil`
2) `-centralManager:didDiscoverPeripheral:`  Retain the `peripheral`, Set the delegate, call `-connectPeripheral:options:`
3) Wait for `-didConnectPeripheral:` Observe that this gets called. Call `-discoverServices:`
4) Observe that `didDiscoverServices` is never called
5) Observe that `-didDisconnectPeripheral:error:` is called with an error "CBErrorDomain Code=0 "Unknown Error". 

On iPad Pro (within 3rd connection) / iOs Other Devices [SUCCESS]
1) `CBCentralManager -scanForPeripheralsWithServices:nil options:nil`
2) `-centralManager:didDiscoverPeripheral:`  Retain the `peripheral`, Set the delegate, call `-connectPeripheral:options:`
3) Wait for `-didConnectPeripheral:` Observe that this gets called. Call `-discoverServices:`
4) Observe that `didDiscoverServices` is called

Expected Results:
`didDiscoverServices`  will be called on the CBPeripheral delegate after connection.

Actual Results:
`didDiscoverServices` is never called on the CBPeripheral delegate. About serveral minutes after 3rd connection (`didConnectPeripheral`), `didDisconnectPeripheral` is called with "CBErrorDomain Code=0 "Unknown Error"


Version:
iOS 9.3.5

Notes:
BLE peripheral hardware device spec is: Bluetooth® Smart SiP BCM20737(Cypress)

Configuration:
iPad Pro(9.7 inch)

Attachments:

Comments

Bluetooth logging and a timestamp provided: 21-Nov-2016


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!