iOS- BLE <CBCharacteristic : does not specify the "Write Without Response" property - ignoring response-less write

标签 ios objective-c bluetooth bluetooth-lowenergy

当我当时加载任何方法时,它会向我显示此警告,因为我正在使用从方法中检索的特性

var cbChar :  CBCharacteristic
 func bleManagerPeripheral(_ peripheral: CBPeripheral!, didUpdateValueFor characteristic: CBCharacteristic!, error: Error!) {
   cbChar = characteristic
}

当我尝试写下一行时收到警告

[self.cb  writeValue:aData forCharacteristic:cbChar type:1];

我正在变暖

[CoreBluetooth] WARNING: Characteristic , notifying = NO> does not specify the "Write Without Response" property - ignoring response-less write

谁能帮帮我?

最佳答案

您正在写入的特性不支持无响应写入,但是当您调用 writeData 时,您正在为 type 参数传递 1 . 1 对应于 CBCharacteristicWriteWithoutResponse。该警告告诉您 Core Bluetooth 无法执行您要求的操作。

您需要指定CBCharacteristicWriteWithResponse

[self.cb  writeValue:aData forCharacteristic:cbChar type: CBCharacteristicWriteWithResponse];

关于iOS- BLE <CBCharacteristic : does not specify the "Write Without Response" property - ignoring response-less write,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50833048/

相关文章:

ios - iOS 中的路径和 URL 有什么区别?

c++ - c++ 中的蓝牙库跨平台

bluetooth - 如何确定蓝牙设备通过 A2DP 支持哪些编解码器

android - 如果未连接到设备,蓝牙将关闭

ios - TableView 填充行,但不填充内容

ios - 与 GPUImage 混合 : How to control the position of the second image on top of the first

ios - 无法使 UIButton 的图层蒙版起作用

objective-c - 在 objective-c 中:按原样打印浮点

objective-c - 进程使用的时间 CPU

ios - 如何存储 128 位值?