Instance Method

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:didUpdateValueForCharacteristic:error: method of its delegate object. If the value of the characteristic is successfully retrieved, you can access it through the characteristic’s value property.

Not all characteristics are guaranteed to have a readable value. You can determine whether a characteristic’s value is readable by accessing the relevant properties of the CBCharacteristicProperties enumeration, which are detailed in CBCharacteristic.

See Also

Reading Characteristic and Characteristic Descriptor Values

func readValue(for: CBDescriptor)

Retrieves the value of a specified characteristic descriptor.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software