我正在开发一个需要与外部设备建立蓝牙连接的应用程序,并且我成功地与外部设备建立了连接。
现在,在下面的 CBPeripheralManager 委托中,在 iOS 10 中生成错误并在 iOS 9.0 中完美运行
func peripheral(peripheral: CBPeripheral, didDiscoverCharacteristicsForService service: CBService, error: NSError?) {
if serviceCharacteristics.keys.contains(service.UUID) {
guard let characteristics = service.characteristics else { return }
peripheral.setNotifyValue(true, forCharacteristic: characteristics[0])
}
我在下面的行中收到错误,
peripheral.setNotifyValue(true, forCharacteristic: characteristics[0])
它说 CBPeripheral 没有成员 setNotifyValue。我不明白。我做了一些解决方法,但没有得到任何帮助。