Corebluetooth error on iPhone 4S?

I have been actively testing the BLE features for iPhone 4 and iPhone 5.

At the moment, all I did was pull out the advertising data from several TI BLE baseball caps and fill out the UITableView using kCBAdvDataLocalName , ManufacturingData and ServiceUUIDs for each corresponding device.

Basically, when I pull in the advertising data, I also do the peripheral UUID and use this to populate the datasource array for the tableview . (i.e. if a new UUID found and it is not in the datasource array, add it to the array and use it to get the corresponding peripheral device).

With the iPhone 5, it works flawlessly. However, when I test the iPhone 4S (and I tested several), the BLE hardware outputs NULL UUIDs , therefore it does not allow me to add any peripheral information to the datasource array. In my console log, the phone does detect every peripheral device and displays its localname and production data, but each device has a zero UUID .

I also ran my test application on 4S and 5 at the same time with the same code, and it will work on 5, not 4S. So I was wondering if anyone has the same problem, was it a bug in the SDK or hardware, or is there a known workaround? Any feedback would be greatly appreciated, thanks.

+4
source share
1 answer

The problem in iOS 6 is that the UUID is not generated until you actually connect to the device. UUIDs are generated on the iOS side for each peripheral device, so you usually see a different UUID for the same peripheral device when using different iOS devices. I usually check the UUID, and then if it is NULL, I will leave on behalf of. However, if the name is NULL, I do not fill it in the list of devices. Another option is to quickly connect and disconnect from the device. A big hack, but it will generate a UUID and then will be non-empty from now on. This issue is expected to be fixed in the next version of iOS.

+3
source

Source: https://habr.com/ru/post/1488717/


All Articles