lucaspbordignon / rn-apple-healthkit

A React Native package for interacting with Apple HealthKit
https://www.npmjs.com/package/react-native-health
MIT License
520 stars 296 forks source link

getDailyDistanceWalkingRunningSamples not working #145

Open anija opened 4 years ago

anija commented 4 years ago

Hi,

i'm trying to get the dailyDistanceWalkingRunning but i always get an ampty array.

Data is there, and i can access it, because getDistanceWalkingRunning works fine: AppleHealthKit.getDistanceWalkingRunning({}, (err, res) => console.log(res)); Returns: {"endDate": "2020-01-29T14:40:00.000+0100", "startDate": "2020-01-29T14:40:00.000+0100", "value": 8046.72}

But the daily aggregate is empty: AppleHealthKit.getDailyDistanceWalkingRunningSamples({ startDate: "2020-01-01T14:40:00.000+0100", endDate: "2020-01-29T14:40:00.000+0100", limit: 5 }, (err, res) => console.log(res)); []

I've tried to add the limit, to remove and add again endDate... no luck. I'm using v0.8.0 on the Emulator.

akinncar commented 4 years ago

Do you tried to manually add samples in your Simulator?

Go to Health app in your simulator > click in "Health Data" from bottom tab > select "Activity" >select "Walking Running DIstance" in list > Add manually samples

anija commented 4 years ago

Yes, in fact i got the results when using the getDistanceWalkingRunning method.

Anyway, i managed to get the Workouts instead of the Distance and opened a PR to fix a bug about the Workout consents. This library has a lot of problem (logs forgotten, lack of documentation, etc).

akinncar commented 4 years ago

Yes, working with this lib yesterday, I watched same problems (and anothers) ;/