当我当时加载任何方法时,它会向我显示此警告,因为我正在使用从方法中检索的特性
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/