I have been trying to get sleep data from the health app using react native. I have been able to get the step count, but haven't been able to get the sleep data.
here is my code
AppleHealthKit.initHealthKit(options: Object, (err: string, results: Object) => {
if (err) {
console.log("error initializing Healthkit: ", err);
return;
}
AppleHealthKit.getSleepSamples(options, (err: Object, results: Array<Object>) => {
if (err) {
console.log(err);
return;
}
this.setState({sleep:results.value})
});
debugging exception :
{message: "error getting sleep samples"}