CBUUID Error while instantiating

I am developing a complex BLE App with custom made hardware. The app is almost finished but from time to time the app crashes unreproducable and I got the following error message:


*** Assertion failure in -[CBUUID initWithData:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/CoreBluetooth/CoreBluetooth-327.1/CBUUID.m:170
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Data <> does not represent a valid UUID'

I do not actively turn data into a CBUUID. Actually I do not use a CBUUID instance in the whole project directly. It must be initiated by another method. If you know where it could be initiated it would be very helpful...


Thanks

Replies

Hi,


I have exactly the same issue: custom hardware, a complex BLE App and crashes realted to turning NSData to a CBUUID. Additionally to the one you've posted above, I also have some crashes with a random amount of bytes inside the "<>" like


Data <01000000 00000000 00000000 00000000 70527900 01000000 00000000 00000000 00000000 01000000 22009f09 3e21e823
      c0597900 01000000 20de7900 01000000 a0597900 01000000 a0797a00 01000000 80eb1f6e 01000000 28220e00 01000000
      70527900 01000000 00000000 00000000>
does not represent a valid UUID


Here's the interesting part of the StackTrace for reference:

11  Foundation                           0x000000018948682c -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 108
12  CoreBluetooth                        0x000000018f5d421c -[CBUUID initWithData:] + 452
13  CoreBluetooth                        0x000000018f5d4434 +[CBUUID UUIDWithData:] + 68
14  CoreBluetooth                        0x000000018f5d28ac -[CBService initWithPeripheral:dictionary:] + 116
15  CoreBluetooth                        0x000000018f5d2034 -[CBPeripheral handleServicesDiscovered:] + 616
16  CoreBluetooth                        0x000000018f5ceef4 -[CBPeripheral handleMsg:args:] + 320
17  CoreBluetooth                        0x000000018f5ca018 -[CBCentralManager handleMsg:args:] + 204
18  CoreBluetooth                        0x000000018f5ddf58 -[CBManager xpcConnectionDidReceiveMsg:args:] + 112
19  CoreBluetooth                        0x000000018f5d670c __30-[CBXpcConnection _handleMsg:]_block_invoke + 56


Unfortunately our App is already shipped to customers which makes this a very serious issue for us.


Would be really nice to find the cause of this issue.


Best regards

I got some more insights:

  • It got a lot worse with the iPhone 7. We received a lot of crash reports from these devices
  • Other Bluetooth apps running in the background have a negative impact
  • (Probably) related errors:
    • [CoreBluetooth] API MISUSE: <private> can only accept commands while in the connected state
      Read on StackOverflow that is related to doing actions on the `CBCentralManager` when it is not ready but the state is `CBManagerStatePoweredOn` when this log appears
    • [CoreBluetooth] XPC connection interrupted, resetting
      As it is saying, the state changes to `CBManagerStateResetting` afterwards
  • It seems to be related with sending "too much" data via BLE. We've sent 24 messages of 20 bytes each in a row. After switching to 22 messages of 20 bytes each it seems to work fine (lowered it even further, just to be sure)

Lowering the rate only reduced the impact of the issue a bit. Still happens to a lot of our customers, even though it is now quite hard for us to reproduce. Tried to get my hands on the issue by using sysdiagnose. However, I had issues using it as described in https://forums.developer.apple.com/message/195799#195799

We see the exact same crash on our custom ble hardware. We can confirm that this got alot worser with iOS10 and/or iPhone 7.


A lot of customers experience this which makes it very critical to us.

Hey Mike,


can you tell me which Bluetooth chip you are using? Is it a Nordic nRF51 or another Nordic chip?


We are btw working with Apple on a solution. They suggested to do some Bluetooth sniffing to see where this faulty UUIDs are coming from and to get better insights for further investigations in this issue. We are currently working on reproducing the issue with the sniffer in place. Will post an update here as soon as we got some results.


Cheers

I can just add to the discussion that we are also seing many similar issues with CoreBluetooth on iOS 10 and in particular when using iPhone 7.

Hi antome,


same question for you: Which Bluetooth chip are using in your hardware?


Cheers


Simon

Well we are using the Dialog DA14580, but I should add that I was referring to the API MISUSE and XPC Connection issues. The CBUUID one I have not seen. API MISUSE for example happens frequently if we are communicating with peripherals that are also using the HID profile, but it does not appear to relate to how much data that is sent (as suggested in an earlier post). We have also seen this error being logged to the device log by iOS itself regardless if our app is being used or not.


We are also currently experiencing a lot of issues with iPhone 7. In particular, having an Apple Watch paired to the device will drastically decrease the reliability of background reconnects. For example, if the Watch is out of proximity then all other pending connections will be ignored while the screen is locked. I have reported most of this already.


/A

Sorry for the late replay.


We are using a csr1012 and we see this mainly while pairing. After the first connection was made successful it does not go away but the frequency decreases.


Any news on this?

I meet same issue. My APP crashes when try to reconnect to iPhone 7.

It appears to be a CoreBluetooth bug.

Anyone got solution now?



*** Assertion failure in -[CBUUID initWithData:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/CoreBluetooth/CoreBluetooth-352.1/CoreBluetooth/CBUUID.m:171

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Data <10000000 00001101> does not represent a valid UUID'

*** First throw call stack:

(0x1837251b8 0x18215c55c 0x18372508c 0x1841dd02c 0x18a36a164 0x18a36a37c 0x18a3687f4 0x18a367f7c 0x18a364e3c 0x18a35ff60 0x18a373ee4 0x18a36c684 0x100b31258 0x100b31218 0x100b3eaec 0x100b34ce0 0x100b3605c 0x1836d2810 0x1836d03fc 0x1835fe2b8 0x1850b2198 0x1896457fc 0x189640534 0x10015c61c 0x1825e15b8)

libc++abi.dylib: terminating with uncaught exception of type NSException