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

Custom HealthKit plugin with energy units fix #127

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

francoisvid
Copy link

fix: HealthKit energy units handling in workout save

Fixed issue with energy units being null when saving workouts to HealthKit.
Changes made:

  • Explicitly create energy unit as kilocalories
  • Ensure energy quantity is properly set for both activity and calorie samples
  • Added support for 'units' array parameter to handle multiple unit types
  • Fixed HKQuantitySample creation to use proper energy quantities

The error "HKCumulativeQuantitySample requires unit of type Energy. Incompatible unit: (null)"
is now resolved by ensuring proper unit initialization and consistent usage throughout
the workout saving process.

This fix allows the plugin to properly save workout data with energy measurements
to the iOS Health app.

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

Successfully merging this pull request may close these issues.

1 participant