What is the maximum size of data advertised as CBAdvertisementDataLocalNameKey when using bluetooth low energy advertising on iOS? While doing some testing I used following code for BLE advertising:
var manager: CBPeripheralManager!
//...
let customData = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
manager.startAdvertising([CBAdvertisementDataServiceUUIDsKey:[serviceCBUUID], CBAdvertisementDataLocalNameKey: customData])
I noticed that on a second device in delegate method called when peripheral is detected (func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber)) my custom data is cut to following string: "01234567" so it has only 8 bytes. The documentation of startAdvertising function mentions something about "up to 28 bytes of space in the initial advertisement data for any combination of the supported advertising data keys". Can someone explain why in my case it is only 8 bytes then? Is it in practice always 8 bytes for this CBAdvertisementDataLocalNameKey on iOS or can this number change? How can I calculate number of bytes that will be successfully send in advertising packet (in my case 8 bytes)? Is there any way to advertise more than 8 bytes when using BLE on iOS? Is there any limitation for number of advertised services at the same time? For example would it be possible to advertise at the same time 10 different uuid's each with 8 bytes which in total would allow to advertise 80 bytes at the same time?