cornr cornr - 4 months ago 111
iOS Question

CoreBluetooth on iOS10: Timeout after CBPeripheral discoverServices

Our App connects to Bluetooth LE Devices via CoreBluetooth.

On iOS 8 and 9 everything works correctly. On iOS 10 we geht a Timeout Error (

Error Domain=CBErrorDomain Code=6 "The connection has timed out unexpectedly."

in the

- (void)centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPeripheral *)peripheral error:(nullable NSError *)error;

after calling
on a connected

Does anyone know whats going wrong? Is this an iOS 10 issue? Is there a certain BLE Log to check?

Setup iOS 10.0.1 (14A403) on iPad Pro 9.7 with a Nordic Semiconductor nRF51822


OK, I solved the Problem. I mixed up CBUUID and NSUUID
starting with iOS 10 CBPeripheral discoverServices only accepts CBUUID. NSUUID does not work anymore. Maybe NSUUID only worked accidentally on older iOS versions. The documentation clearly states:

A list of CBUUID objects representing the service types to be discovered.

NSArray *services = @[
    [CBUUID UUIDWithString:ServiceUUID] //Correct
    //[[NSUUID alloc] initWithUUIDString:ServiceUUID] //Does work on iOS 9 but not on iOS 10
[self.peripheral discoverServices:services];

looking forward to port the app to strongly typed Swift.