peripheral(_:didWriteValueFor:error:)
Tells the delegate that the peripheral successfully set a value for the characteristic.
Declaration
optional func peripheral(_ peripheral: CBPeripheral, didWriteValueFor characteristic: CBCharacteristic, error: (any Error)?)Parameters
- peripheral:
The peripheral providing this information.
- characteristic:
The characteristic containing the value.
- error:
The reason the call failed, or
nilif no error occurred.
Discussion
Core Bluetooth invokes this method only when your app calls the writeValue(_:for:type:) method with the CBCharacteristicWriteType.withResponse constant specified as the write type. If successful, the error parameter is nil. If unsuccessful, the error parameter returns the cause of the failure.