I'm publishing a Bluetooth LE service with three characteristics. I write 512 bytes of data on each of the first two characteristics and 1 byte on the second. The write is working properly. I know this because I browse for the device using a second device (both iOS 8.x), they find each other and the data is read properly. However, when reading the same characteristic on an iPhone 4S with iOS 7.1.2 I only get 268 bytes of data per characteristic, instead of the full 512 bytes.
To read the data I write the following in -peripheral:didDiscoverCharacteristicsForService:error:
for (CBCharacteristic * characteristic in service.characteristics) {
//[peripheral setNotifyValue:YES forCharacteristic:characteristic];
[peripheral readValueForCharacteristic:characteristic];
}
I also tried it with the -setNotifyValue:forCharacteristic:
line uncommented. I get the data in -peripheral:didUpdateValueForCharacteristic:error:
. Again, the data is read properly on iOS 8.x, but not 7. What happens is that the data for each characteristic is truncated to 268 bytes. That is, I get the first 268 bytes of the first and the second, and I get the full 1 byte of the third.
As anyone experienced something like this? Can anyone reproduce or help? Best.
Edit: As @Paulw11 replied in the comments, the same question was posted here with a solution. I've tested it and not only does it solve the problem but it's also much faster at transferring data. The problem is, it transfer the data serially, which is something that in my situation I don't see how I can apply. The thing is: I have a constant amount of data that a peripheral publishes onto a fixed number of characteristics, but there'll be several centrals reading the data from it. The fact that several centrals are reading the data prevents me from doing it serially (I think) as there's no way that several centrals can read at the same time.