Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Bluetooth CBCharacteristic UUID deprecated?

Tags:

ios

bluetooth

In the latest Apple docs, the UUID property of a CBCharacteristic has a line drawn through it, and the notation that it is available only in 5.0 through 7.1. But the word "deprecated", which you usually expect to see, is nowhere in sight.

More to the point, there is no suggestion of how else we can identify a characteristic, e.g. when we are passed one in the delegate method peripheral:didUpdateValueForCharacteristic:. In that method, it is critical to decide which characteristic I am dealing with. The descriptors member of the CBCharacteristic instance is nil. What else is there? How does Apple intend for us to distinguish between characteristics? The whole point of UUIDs is identification...

like image 850
Andrew Duncan Avatar asked Oct 02 '14 20:10

Andrew Duncan


2 Answers

Looking at the header for CBCharacteristic sheds some light on this. There is no more UUID property in the class, but CBCharacteristic is now a subclass of CBAttribute, which does have the UUID property. And this (new) parent class is marked as being available starting in iOS 8.

This can explain why the UUID member has a strikethrough, but no "deprecated" warning: you can still get the UUID, but it is inherited rather than belonging to CBAttribute directly.

like image 139
Andrew Duncan Avatar answered Sep 29 '22 18:09

Andrew Duncan


UUID turned into an inherited attribute from iOS8
Here is the evidence from Apple's document
CoreBluetooth Changes in IOS8 API diffs

CBAttribute.h (Added)

Added CBAttribute
Added CBAttribute.UUID

CBCharacteristic.h

Removed CBCharacteristic.UUID
Modified CBCharacteristic
Superclasses:
From NSObject To CBAttribute


And many other basic CoreBluetooth classes(who contains UUID) adopts this change
However, class reference of CBCharacteristic still says it inherits from NSObject.
So it is misguiding and developers can easily understand UUID as a deprecated attribute in iOS8

like image 36
duan Avatar answered Sep 29 '22 17:09

duan