writeWeight(record)
Writes a body-weight record to the device’s health store. If needed, presents a permissions prompt to the user to request access to health data first, and then writes the record.
record—(Required) AWeightRecordobject that represents the weight measurement to write. Provide avaluegreater than 0 and a validunit.
-
A resolved promise returns no object.
-
A rejected promise returns a
HealthServiceFailureobject containing details about the error.
This function writes a single weight record to the device’s health store.
- When the record is written, the promise resolves with no value. Handle success in a
thenclause. - If an error occurs, the error is returned via a rejected promise. Handle errors in a
catchclause. - If the user denies permission to write health data, the promise is rejected with a
HealthServiceFailure.codevalue ofUSER_DENIED_PERMISSION. - Permission to write health data is granted separately from permission to read it.
See Also