peripheral(_:didUpdateValueFor:error:)
Tells the delegate that retrieving the specified characteristic’s value succeeded, or that the characteristic’s value changed.
Declaration
optional func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor 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 when your app calls the readValue(for:) method. A peripheral also invokes this method to notify your app of a change to the value of the characteristic for which the app previously enabled notifications by calling setNotifyValue(_:for:). If successful, the error parameter is nil. If unsuccessful, the error parameter returns the cause of the failure.