Skip to content

Custom HealthKit plugin with energy units fix#127

Open
francoisvid wants to merge 1 commit intoEddyVerbruggen:masterfrom
francoisvid:fix/healthkit-energy-unit
Open

Custom HealthKit plugin with energy units fix#127
francoisvid wants to merge 1 commit intoEddyVerbruggen:masterfrom
francoisvid:fix/healthkit-energy-unit

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