iOS蓝牙CBCharacteristic UUID已弃用? [英] iOS Bluetooth CBCharacteristic UUID deprecated?

查看:378
本文介绍了iOS蓝牙CBCharacteristic UUID已弃用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在最新的Apple文档中,CBCharacteristic的UUID属性画了一条线,并指出仅在5.0到7.1中可用.但是您通常希望看到的已弃用"一词不在眼前.

更重要的是,没有建议我们还可以如何识别特征,例如当我们在委托方法peripheral:didUpdateValueForCharacteristic:中传递一个时.在这种方法中,决定我要处理的 特性至关重要. CBCharacteristic实例的描述符成员为nil.那里还有什么?苹果打算如何区分这些特征? UUID的重点就是识别...

解决方案

UUID变成了iOS8的继承属性
这是苹果文件中的证据
IOS8 API差异中的CoreBluetooth变化

CBAttribute.h(已添加)

添加了CBAttribute
添加了CBAttribute.UUID

CBCharacteristic.h

已删除CBCharacteristic.UUID
修改后的CBCharacteristic
超类:
从NSObject 转到CBAttribute


以及许多其他基本的CoreBluetooth类(包含UUID)都采用了此更改
但是,CBCharacteristic的类引用仍然说它继承自NSObject.
因此存在误导,开发人员可以轻松地将UUID理解为iOS8中已弃用的属性

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...

解决方案

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

这篇关于iOS蓝牙CBCharacteristic UUID已弃用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆