I'm testing longevity/robustness issues now and need to debug occasional core Bluetooth errors, like #242.
Is there a list from Apple of what each core Bluetooth error means?
The Core Bluetooth framework provides the classes needed for your apps to communicate with Bluetooth-equipped low energy (LE) and Basic Rate / Enhanced Data Rate (BR/EDR) wireless technology.
iOS supports and connects to two different type of Bluetooth devices – one that is termed as BLE – Bluetooth Low Energy device and the other is a Bluetooth classic device.
The CBPeripheral class represents remote peripheral devices that your app discovers with a central manager (an instance of CBCentralManager ). Peripherals use universally unique identifiers (UUIDs), represented by NSUUID objects, to identify themselves.
A universally unique identifier, as defined by Bluetooth standards.
Normally, CoreBluetooth uses the standard error codes as defined in Bluetooth Core Spec V4.0 Vol 3 Part F Sec 3.4.1.1 Table 3.3 Error Codes.
Error
Name Code Description
==============================================================================
Invalid Handle 0x01 The attribute handle given was not valid on
this server.
Read Not Permitted 0x02 The attribute cannot be read.
Write Not Permitted 0x03 The attribute cannot be written.
Invalid PDU 0x04 The attribute PDU was invalid.
Insufficient Authentication 0x05 The attribute requires authentication
before it can be read or written.
Request Not Supported 0x06 Attribute server does not support the
request received from the client.
Invalid Offset 0x07 Offset specified was past the end of the
attribute.
Insufficient Authorization 0x08 The attribute requires authorization before
it can be read or written.
Prepare Queue Full 0x09 Too many prepare writes have been queued.
Attribute Not Found 0x0A No attribute found within the given
attribute handle range.
Attribute Not Long 0x0B The attribute cannot be read or written
using the Read Blob Request
Insufficient Encryption Key 0x0C The Encryption Key Size used for encrypting
Size this link is insufficient.
Invalid Attribute Value 0x0D The attribute value length is invalid for
Length the operation.
Unlikely Error 0x0E The attribute request that was requested
has encountered an error that was unlikely,
and therefore could not be completed as
requested.
Insufficient Encryption 0x0F The attribute requires encryption before it
can be read or written.
Unsupported Group Type 0x10 The attribute type is not a supported
grouping attribute as defined by a higher
layer specification.
Insufficient Resources 0x11 Insufficient Resources to complete the
request
Reserved 0x012 – 0x7F Reserved for future use.
Application Error 0x80 – 0xFF Application error code defined by a higher
layer specification.
Note that iOS has certain issues where arbitrary error codes show up. For example, if you fail to answer a request as a peripheral app within a certain time, the returned error code does not have any meaning.
The real error codes are always only visible in warnings that are printed to the console. The NSError doesn't provide any detailed information in any case with CoreBluetooth I encountered so far.
Apple's documentation contains a list of CoreBluetooth Constants which contains most error codes you'll receive back from the framework.
I've also started a Wikia site for CoreBluetooth to collect additional information about the circumstances under which people encounter specific errors.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With