【问题标题】:How to get exact value from a CBCharacteristic?如何从 CBCharacteristic 中获取准确值?
【发布时间】:2016-10-26 18:05:14
【问题描述】:
<CBCharacteristic: 0x156d48cf0, UUID = BLevel, properties = 0x18, value = <32353732 380d0a>, notifying = YES>

我想提取 value 字段中的内容。

NSData *data = c.value; // c is of type CBCharacteristic

但不知道是哪种值?

【问题讨论】:

标签: ios bluetooth-lowenergy core-bluetooth


【解决方案1】:

您可以使用

NSData 转换为 NSString
NSString *str = [[NSString alloc] initWithData:c.value encoding:NSUTF8StringEncoding];

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-11
    • 2018-11-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-28
    相关资源
    最近更新 更多