Health & Fitness

RSS for tag

Explore the technical aspects of health and fitness features, including sensor data acquisition, health data processing, and integration with the HealthKit framework.

Health & Fitness Documentation

Posts under Health & Fitness subtopic

Post

Replies

Boosts

Views

Activity

Unable to invalidate interval: no data source available error when fetching steps using HKStatisticsCollectionQuery
While attempting to read a user’s daily step history spanning backward to the last 7 days, a small but consistent subset of users encounter Error Code 3 with the underlying error description: Error Code 3 "Unable to invalidate interval: no data source available." When this error occurs, we are entirely unable to read their step history. We have received ~10 direct user reports of this within the last couple of weeks.
13
2
863
3d
Detecting External Heart Rate Monitor Availability
I've noticed that the Fitness app on the iPhone can rapidly detect the presence of an Apple Watch or External Heart Rate Monitor (e.g., AirPods Pro 3) so that it can adjust the availability of certain exercise types. Is this done through an API that is public? Can third party fitness apps access similar functionality so users can be pre-alerted to the availability of workout types that require a heart rate sensor of some sort?
2
0
186
4d
Cycling VO2max
Can Apple Watch please add support for cycling VO2max algorithm and tracking? I sheared my meniscus trail running, ending my running career, and I’m solely cycling for cardio now. I’ve now had to adopt a xxxxxx watch which supports cycling VO2max calc and tracking, and I miss my Apple Watch. Enabling BT pairing to a power meter would provide HR-Power-Cadence (or with a head unit synched to a pm ++ Speed and VAM)
4
0
105
5d
Saving workout routes on the phone when locked
I'm using HKLiveWorkoutDataSource and HKWorkoutRouteBuilder. The running workouts my app supports can be timed or distance-based, so the user may complete the workout while the phone is locked. In this case, the workout route cannot be saved because HealthKit is locked. To work around this issue, I save route data to the device and listen for UIApplication.protectedDataDidBecomeAvailableNotification to later add the route to the workout. Note, this is not needed on the watch, just the phone. Is this limitation by design, or is there a better way to handle it? BTW, thanks for making these APIs available on the phone in iOS 26 and also adding the heart rate zone APIs in 27
3
0
116
5d
Editing Apple Health Workouts
Sometimes my users would like to update an Apple Health workout after it's been saved. For example, maybe they forgot to end the workout and want to trim it. Or maybe it was a treadmill workout, and they want to add the stats from the treadmill. The way I've attempted to do this in the past is to create a new HKWorkoutBuilder, call beginCollection, and add the data the user wants to keep from the original workout (events, activities, samples, workout route, and metadata with an incremented HKMetadataKeySyncIdentifier. After all that, I call endCollection() and finishWorkout() on the builder. Is this the right way to go about it? For trimming a workout, it would be great to have a way to just duplicate a workout with an adjusted start and end time and have HealthKit do all the hard work of trimming data.
2
0
78
5d
About measuring running distance in a standard 400m playground
Everyday, when I am running on a standard 400m playground,I suffer that the distance which Apple Watch shows is always about 50m less than the standard 400m. If I run a much longer distance ,the terrible mistake nearly drives me mad. Also, the location the Apple Watch shows is often completely mistaken from the real.In China ,the playground mode still cannot be used, all aspects of the running exercises measuring give us a terrible experience.How could you deal with it and now what methods we have can avoid these problems?!!!
1
0
64
5d
Apple Health vs Siri AI
I have an app which allows users to track metrics not tracked by HealthKit. Where HealthKit is available we do sync there. I haven't had much time to play with it yet so I'm still trying to figure out the scope of what I might do, but I'm interested in adding Siri AI features to the app. I was wondering if there is any general guidance around either submitting non-HealthKit data to Siri AI. Both technical and non-technical. For example, is there any rule against submitting health data to Siri AI? And is there a recommended way to associate data with HealthKit. For example in the app body water percentage can be associated with a Body Mass entry in HealthKit.
1
0
133
5d
When will the bundle identifier parameter change in Apple Health?
Recently, I am developing an app based on user health data tracking, which involves a scenario where a user wears multiple electronic watches. In this case, I need to distinguish the data sources to prevent the data from not being correctly distinguished when the user wears multiple watches. Currently, bundle identifier seems to be a great choice for me, but after trying to read the materials, it seems that after unbinding, I rebind it. Alternatively, rebinding on another phone would cause this parameter to change. Do you have any better ideas?
1
0
66
5d
Academic research inquiry — population-scale circadian data access
I'm a biomedical researcher specializing in chronobiology and circadian time-series analysis. I'm developing cosinor-based algorithms for circadian phenotyping and chronotherapy optimization at the individual level, and I'm at the point where population-scale data would meaningfully improve model calibration. Apple Health's longitudinal passive sensor streams — particularly HRV, sleep staging, resting heart rate, and activity cadence — are well-suited to this kind of work. My question is whether Apple has an established pathway for academic researchers to access aggregate or privacy-preserving representations of Health data (e.g., via differential privacy or federated computation), and if so, what the eligibility and process look like.
2
0
101
5d
About measuring running distance in a standard 400m playground
Everyday, when I am running on a standard 400m playground,I suffer that the distance which Apple Watch shows is always about 50m less than the standard 400m. If I run a much longer distance ,the terrible mistake nearly drives me mad. Also, the location the Apple Watch shows is often completely mistaken from the real.In China ,the playground mode still cannot be used, all aspects of the running exercises measuring give us a terrible experience.How could you deal with it and now what methods we have can avoid these problems?!!!
2
0
65
5d
Checking Apple Health permissions
Is it safe to call HKHealthStore authorizationStatus() and getRequestStatusForAuthorization() on the main thread? It seems that these methods occasionally block. Any best practices for guiding a user to grant all required Apple Health permissions for a workout app? Because of privacy concerns, its difficult to know what permissions a user has granted or denied in order to guide them appropriately.
2
1
131
5d
Health data on iPad via iCloud
What’s the recommended way to determine whether HealthKit data is being accessed on an iPad versus an iPhone? My goal isn’t really to identify the device type itself, but to know whether the HealthKit data is likely being viewed on the device where it was originally recorded, or on a device that receives the data via HealthKit/iCloud syncing. This matters because synced HealthKit data can appear with a delay, and I’d like to set appropriate expectations for users. I previously used UITraitCollection.current.userInterfaceIdiom == .pad as a proxy for this, but that API is being deprecated. Is there a better way to distinguish between locally recorded HealthKit data and data that has arrived via sync, or otherwise identify when the app is running on an iPad?
4
1
155
5d
Medication API suggestions
Since there were not 1:1 labs available for HealthKit, I’d like to just share to the team continued interest in some feedbacks related to Medication API from last year. FB18310503 FB18310200 FB18309972 To update the post with a question, are there any medications API changes since the release in iOS 26.0? There was a short session video last summer but I haven't found anything 'new'.
3
0
89
5d
Recommended HealthKit representation for self-reported focus sessions?
We ship a focus timer where every session is user-initiated: the user deliberately starts a 25- or 45-minute session, then it's logged. We'd like that focused time to live in the user's health picture alongside sleep, exercise, and State of Mind, as self-reported context — the same standing as manually entered steps, and never inferred from device usage. The nearest interval type today is HKCategoryTypeIdentifier.mindfulSession, but its semantics are meditation. Is writing focused-work intervals to mindfulSession considered a misuse of the type? And if so, what's the recommended way to represent self-reported focus time until a dedicated type exists?
1
0
87
5d
Where does ResearchKit live in the era of Liquid Glass and SwiftUI-first development?
When will ResearchKit get the needed overhaul to be fully compatible with Liquid Glass? CareKit is a SwiftUI first offering with many customization points, but ResearchKit, its older sibling, hasn’t merged the SwiftUI work. I’d like to see SwiftUI, distribution as a Swift Package, and more frequent versioned releases. Can anything be shared on the state of and plans for ResearchKit going forward? It is open source so there isn’t a good way to file feedback other than just sending to the HealthKit team. FB9558499 FB15694524 FB20292373
1
0
88
5d
Sleep Disturbances API enhancements
Since there were not 1:1 labs available for HealthKit, I’d like to just share to the team continued interest in some feedbacks related to the sleep disturbances API from last year. FB20332832 FB20330679 To make this not just a transfer of feedbacks here is a question. How can you create a sleep disturbance value on the simulator? The Health app allows you to show a sheet to create one, but the values I enter don't seem to be valid and the save button is never functional. FB20979381 - Simulator / HealthKit: The Simulator allows for launching a 'create breathing disturbances' sample but never permits saving
2
1
64
5d
Unable to invalidate interval: no data source available error when fetching steps using HKStatisticsCollectionQuery
While attempting to read a user’s daily step history spanning backward to the last 7 days, a small but consistent subset of users encounter Error Code 3 with the underlying error description: Error Code 3 "Unable to invalidate interval: no data source available." When this error occurs, we are entirely unable to read their step history. We have received ~10 direct user reports of this within the last couple of weeks.
Replies
13
Boosts
2
Views
863
Activity
3d
Detecting user wakeup from Apple WatchOS 27
Does Apple WatchOS 27 support my iOS 27 app being notified when the user wakes up?
Replies
1
Boosts
0
Views
130
Activity
3d
Detecting External Heart Rate Monitor Availability
I've noticed that the Fitness app on the iPhone can rapidly detect the presence of an Apple Watch or External Heart Rate Monitor (e.g., AirPods Pro 3) so that it can adjust the availability of certain exercise types. Is this done through an API that is public? Can third party fitness apps access similar functionality so users can be pre-alerted to the availability of workout types that require a heart rate sensor of some sort?
Replies
2
Boosts
0
Views
186
Activity
4d
Cycling VO2max
Can Apple Watch please add support for cycling VO2max algorithm and tracking? I sheared my meniscus trail running, ending my running career, and I’m solely cycling for cardio now. I’ve now had to adopt a xxxxxx watch which supports cycling VO2max calc and tracking, and I miss my Apple Watch. Enabling BT pairing to a power meter would provide HR-Power-Cadence (or with a head unit synched to a pm ++ Speed and VAM)
Replies
4
Boosts
0
Views
105
Activity
5d
Saving workout routes on the phone when locked
I'm using HKLiveWorkoutDataSource and HKWorkoutRouteBuilder. The running workouts my app supports can be timed or distance-based, so the user may complete the workout while the phone is locked. In this case, the workout route cannot be saved because HealthKit is locked. To work around this issue, I save route data to the device and listen for UIApplication.protectedDataDidBecomeAvailableNotification to later add the route to the workout. Note, this is not needed on the watch, just the phone. Is this limitation by design, or is there a better way to handle it? BTW, thanks for making these APIs available on the phone in iOS 26 and also adding the heart rate zone APIs in 27
Replies
3
Boosts
0
Views
116
Activity
5d
Editing Apple Health Workouts
Sometimes my users would like to update an Apple Health workout after it's been saved. For example, maybe they forgot to end the workout and want to trim it. Or maybe it was a treadmill workout, and they want to add the stats from the treadmill. The way I've attempted to do this in the past is to create a new HKWorkoutBuilder, call beginCollection, and add the data the user wants to keep from the original workout (events, activities, samples, workout route, and metadata with an incremented HKMetadataKeySyncIdentifier. After all that, I call endCollection() and finishWorkout() on the builder. Is this the right way to go about it? For trimming a workout, it would be great to have a way to just duplicate a workout with an adjusted start and end time and have HealthKit do all the hard work of trimming data.
Replies
2
Boosts
0
Views
78
Activity
5d
BGHealthResearchTaskRequest beyond Health Research apps
Please could you give access to BGHealthResearchTaskRequest beyond Health Research apps. I can't see any rational why this API is restricted to Health Research apps. Without it, it is impossible to provide a decent UX based on historical data. Thanks, Stéphane FB22560687
Replies
3
Boosts
0
Views
93
Activity
5d
iOS kills the app while HKObserverQuery in background
Time to time, my app is killed in the background while handling HKObserverQuery. I always call the completion handler using a defer handler. It looks like I query a lot of data in the background. Can this be a reason for background termination, and how to handle it gracefully?
Replies
1
Boosts
1
Views
89
Activity
5d
About measuring running distance in a standard 400m playground
Everyday, when I am running on a standard 400m playground,I suffer that the distance which Apple Watch shows is always about 50m less than the standard 400m. If I run a much longer distance ,the terrible mistake nearly drives me mad. Also, the location the Apple Watch shows is often completely mistaken from the real.In China ,the playground mode still cannot be used, all aspects of the running exercises measuring give us a terrible experience.How could you deal with it and now what methods we have can avoid these problems?!!!
Replies
1
Boosts
0
Views
64
Activity
5d
Apple Health vs Siri AI
I have an app which allows users to track metrics not tracked by HealthKit. Where HealthKit is available we do sync there. I haven't had much time to play with it yet so I'm still trying to figure out the scope of what I might do, but I'm interested in adding Siri AI features to the app. I was wondering if there is any general guidance around either submitting non-HealthKit data to Siri AI. Both technical and non-technical. For example, is there any rule against submitting health data to Siri AI? And is there a recommended way to associate data with HealthKit. For example in the app body water percentage can be associated with a Body Mass entry in HealthKit.
Replies
1
Boosts
0
Views
133
Activity
5d
When will the bundle identifier parameter change in Apple Health?
Recently, I am developing an app based on user health data tracking, which involves a scenario where a user wears multiple electronic watches. In this case, I need to distinguish the data sources to prevent the data from not being correctly distinguished when the user wears multiple watches. Currently, bundle identifier seems to be a great choice for me, but after trying to read the materials, it seems that after unbinding, I rebind it. Alternatively, rebinding on another phone would cause this parameter to change. Do you have any better ideas?
Replies
1
Boosts
0
Views
66
Activity
5d
Academic research inquiry — population-scale circadian data access
I'm a biomedical researcher specializing in chronobiology and circadian time-series analysis. I'm developing cosinor-based algorithms for circadian phenotyping and chronotherapy optimization at the individual level, and I'm at the point where population-scale data would meaningfully improve model calibration. Apple Health's longitudinal passive sensor streams — particularly HRV, sleep staging, resting heart rate, and activity cadence — are well-suited to this kind of work. My question is whether Apple has an established pathway for academic researchers to access aggregate or privacy-preserving representations of Health data (e.g., via differential privacy or federated computation), and if so, what the eligibility and process look like.
Replies
2
Boosts
0
Views
101
Activity
5d
About measuring running distance in a standard 400m playground
Everyday, when I am running on a standard 400m playground,I suffer that the distance which Apple Watch shows is always about 50m less than the standard 400m. If I run a much longer distance ,the terrible mistake nearly drives me mad. Also, the location the Apple Watch shows is often completely mistaken from the real.In China ,the playground mode still cannot be used, all aspects of the running exercises measuring give us a terrible experience.How could you deal with it and now what methods we have can avoid these problems?!!!
Replies
2
Boosts
0
Views
65
Activity
5d
Checking Apple Health permissions
Is it safe to call HKHealthStore authorizationStatus() and getRequestStatusForAuthorization() on the main thread? It seems that these methods occasionally block. Any best practices for guiding a user to grant all required Apple Health permissions for a workout app? Because of privacy concerns, its difficult to know what permissions a user has granted or denied in order to guide them appropriately.
Replies
2
Boosts
1
Views
131
Activity
5d
Any Apple Health app updates this year?
Are there any updates to the Health app to be aware of that are part of the releases but weren’t mentioned in the keynote or PSTOU? The heart rate zones didn’t mention anything either, perhaps there are no changes other than that and the new menopause related data.
Replies
2
Boosts
1
Views
134
Activity
5d
Health data on iPad via iCloud
What’s the recommended way to determine whether HealthKit data is being accessed on an iPad versus an iPhone? My goal isn’t really to identify the device type itself, but to know whether the HealthKit data is likely being viewed on the device where it was originally recorded, or on a device that receives the data via HealthKit/iCloud syncing. This matters because synced HealthKit data can appear with a delay, and I’d like to set appropriate expectations for users. I previously used UITraitCollection.current.userInterfaceIdiom == .pad as a proxy for this, but that API is being deprecated. Is there a better way to distinguish between locally recorded HealthKit data and data that has arrived via sync, or otherwise identify when the app is running on an iPad?
Replies
4
Boosts
1
Views
155
Activity
5d
Medication API suggestions
Since there were not 1:1 labs available for HealthKit, I’d like to just share to the team continued interest in some feedbacks related to Medication API from last year. FB18310503 FB18310200 FB18309972 To update the post with a question, are there any medications API changes since the release in iOS 26.0? There was a short session video last summer but I haven't found anything 'new'.
Replies
3
Boosts
0
Views
89
Activity
5d
Recommended HealthKit representation for self-reported focus sessions?
We ship a focus timer where every session is user-initiated: the user deliberately starts a 25- or 45-minute session, then it's logged. We'd like that focused time to live in the user's health picture alongside sleep, exercise, and State of Mind, as self-reported context — the same standing as manually entered steps, and never inferred from device usage. The nearest interval type today is HKCategoryTypeIdentifier.mindfulSession, but its semantics are meditation. Is writing focused-work intervals to mindfulSession considered a misuse of the type? And if so, what's the recommended way to represent self-reported focus time until a dedicated type exists?
Replies
1
Boosts
0
Views
87
Activity
5d
Where does ResearchKit live in the era of Liquid Glass and SwiftUI-first development?
When will ResearchKit get the needed overhaul to be fully compatible with Liquid Glass? CareKit is a SwiftUI first offering with many customization points, but ResearchKit, its older sibling, hasn’t merged the SwiftUI work. I’d like to see SwiftUI, distribution as a Swift Package, and more frequent versioned releases. Can anything be shared on the state of and plans for ResearchKit going forward? It is open source so there isn’t a good way to file feedback other than just sending to the HealthKit team. FB9558499 FB15694524 FB20292373
Replies
1
Boosts
0
Views
88
Activity
5d
Sleep Disturbances API enhancements
Since there were not 1:1 labs available for HealthKit, I’d like to just share to the team continued interest in some feedbacks related to the sleep disturbances API from last year. FB20332832 FB20330679 To make this not just a transfer of feedbacks here is a question. How can you create a sleep disturbance value on the simulator? The Health app allows you to show a sheet to create one, but the values I enter don't seem to be valid and the save button is never functional. FB20979381 - Simulator / HealthKit: The Simulator allows for launching a 'create breathing disturbances' sample but never permits saving
Replies
2
Boosts
1
Views
64
Activity
5d