Contents

writeValue(_:for:)

Writes the value of a characteristic descriptor.

Declaration

func writeValue(_ data: Data, for descriptor: CBDescriptor)

Parameters

  • data:

    The value to write.

  • descriptor:

    The descriptor containing the value to write.

Discussion

When you call this method to write the value of a characteristic descriptor, the peripheral calls the peripheral(_:didWriteValueFor:error:) method of its delegate object.

This method copies the data passed into the data parameter, and you can dispose of it after the method returns.

You can’t use this method to write the value of a client configuration descriptor (represented by the CBUUIDClientCharacteristicConfigurationString constant), which describes the configuration of notification or indications for a characteristic’s value. If you want to manage notifications or indications for a characteristic’s value, you must use the setNotifyValue(_:for:) method instead.

See Also

Writing Characteristic and Descriptor Values