![](/img/trans.png)
[英]iOS BLE peripheral writeValue doesn't work if I readValue
[英]BLE writeValue to peripheral
我无法将值写入BLE设备。 我翻译了这个:
NSLog(@"Writing value for characteristic %@", interestingCharacteristic);
[peripheral writeValue:dataToWrite forCharacteristic:interestingCharacteristic
type:CBCharacteristicWriteWithResponse];
到Swift:
peripheral.writeValue("Writing value for characteristic", forCharacteristic: interestingCharacteristic, type: CBCharacteristicWriteWithResponse)
但是我得到了Use of unresolved identifier 'CBCharacteristicWriteWithResponse'
的错误
我是iOs编程的新手,并尝试了多种方法使其正常工作,但那不会发生。 你能帮我吗。
您已经将NSLog
语句和writeValue
方法组合成某种奇怪的混搭。
你想要的是
println("Writing value for characteristic \(interestingCharacteristic)")
peripheral.writeValue(dataToWrite, forCharacteristic:interestingCharacteristic, type: CBCharacteristicWriteType.WithResponse)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.