如何在swift4的蓝牙外围设备中获得特性值?

时间:2018-12-05 06:32:47

标签: ios swift4 core-bluetooth cbperipheral

  <CBCharacteristic: 0x281bc6100, UUID = FFF1, properties = 0x10, value = <500c0b62 00008f2c 10223344 55660000 00000000>, notifying = NO>

我想要这个值“ <500c0b62 00008f2c 10223344 55660000 00000000>”

有人可以帮助我吗?

1 个答案:

答案 0 :(得分:-1)

尝试

if(characteristic.value != nil){
            if let ASCIIstring = NSString(data: characteristic.value!, encoding: String.Encoding.utf8.rawValue) {
                characteristicASCIIValue = ASCIIstring
                print("Value Recieved: \((characteristicASCIIValue as String))")

            }
        }