Closed VictorNIvanov closed 4 years ago
Hello @VictorNIvanov, can be possibile you are not using a Promise? it should be
let theDates = { startDate: "2019-12-02", endDate: "2019-12-03" };
let steps = await Fitness.getSteps(theDates);
console.log("Steps...");
console.log(steps);
Please let me know if it helps.
Hello @Francesco-Voto,
Thank you for the quick response! Adding "await" did work... just had to move it to an async function.
I will leave a working example just in case anybody else has difficulties with this...
async getSteps(){
let theDates = { startDate: "2019-12-02", endDate: "2019-12-04" };
let steps = await Fitness.getSteps(theDates);
console.log("Steps...");
console.log(steps);
if(steps[0].quantity){
this.setState({ steps: steps[0].quantity }); // update the app state to refresh the UI
}
}
Hello,
I cant seem to get any results returned from either Fitness.getSteps or Fitness.getDistance. I have tested this on a simulator with manually entered data in the HealthKit as well as on a device that has walking distance and steps data for each day... (iOS)
The code that I am using is the following:
All it returns for any date or combination of dates is :
I have double checked and the application does have access to the HealthKit data. Any help will be greatly appreciated!!
Have an awesome day!