Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting Workout data does not work #160

Open
ix42 opened this issue May 18, 2020 · 3 comments
Open

Getting Workout data does not work #160

ix42 opened this issue May 18, 2020 · 3 comments

Comments

@ix42
Copy link

ix42 commented May 18, 2020

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

@agnieszkabugla
Copy link

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?

@ix42
Copy link
Author

ix42 commented May 28, 2020

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)

@maxstudener
Copy link

maxstudener commented Nov 3, 2020

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 maxstudener@2f65463

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants