Getting Workout data does not work
Getting workout data does not seem to work properly. Can you please check the code if Workout permissions are properly handled?
Running the following code:
const options = { read: [ PERM.Workout ] }
AppleHealthKit.initHealthKit(options, (err, results) => {
console.log(err);
})
const wopt = {
startDate: (new Date(2020,5,17)).toISOString(),
endDate: (new Date()).toISOString(),
type: 'Workout'
}
AppleHealthKit.getSamples(wopt, (err, results) => {
console.log(err);
})
Behavior:
- getSamples() fails with "error getting samples"
- initHealthKit() runs with no error. Also, no permissioning dialog pops up on the phone
- phone console message says that authorization was not granted ("Authorization not determined"
Might be linked to the fact that RCTAppleHealthKit+TypesAndPermissions.m returns nil for "Workout"
Thank you
I've run into the same problem. getSamples returns "error getting samples", while other methods, like getFlightsClimbed(), getStepCount() or getSleepSamples() return real data.
@ix42 , have you found a solution to this issue?
Yes, i went for another fork of the project, you can check my fork or the one from https://github.com/nutrisense
Actually the best version of rn-apple-healthkit would theoretically be one in which the main repo would sync with the work done by nutrisense (kudos to both)
I am also getting this error, I believe if it because PERMS.Workout doesn't actually request permission to access workouts. When I install https://github.com/nutrisense/rn-apple-healthkit and get that library to request access and then switch back to this library it then works.
This fixed it for me https://github.com/maxstudener/rn-apple-healthkit/commit/2f654633bbbe1b153d61907ad3cca388bd92c542