Contents

readValue(for:)

Retrieves the value of a specified characteristic.

Declaration

func readValue(for characteristic: CBCharacteristic)

Parameters

  • characteristic:

    The characteristic whose value you want to read.

Discussion

When you call this method to read the value of a characteristic, the peripheral calls the peripheral(_:didUpdateValueFor:error:) method of its delegate object. If the peripheral successfully reads the value of the characteristic, you can access it through the characteristic’s value property.

Not all characteristics have a readable value. You can determine whether a characteristic’s value is readable by accessing the relevant properties of the CBCharacteristicProperties enumeration.

See Also

Reading Characteristic and Descriptor Values