I'm currently collecting real-time heart rate data using HKWorkoutSession. I want to track when the Apple Watch is physically removed from the user's wrist during an active workout.
However, I've noticed that workoutBuilder(_:didCollectDataOf:) continues to be called even after the watch is removed from the wrist.
Is there a way to detect when the Apple Watch is removed from the wrist during an active HKWorkoutSession? Or is this tracking not possible through the HealthKit framework?
Any guidance or alternative approaches would be appreciated.
Health & Fitness
RSS for tagExplore the technical aspects of health and fitness features, including sensor data acquisition, health data processing, and integration with the HealthKit framework.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Created
Hello everyone,
I’m experiencing a visual issue when dismissing a sheet on iOS 26.
I’m using the same implementation shown in the official Apple documentation. While testing, I noticed that some apps do not exhibit this behavior. However, when running this code on iOS 26, the issue consistently occurs.
Issue description:
The sheet dismisses abruptly
A white screen briefly appears for a few milliseconds and then disappears
This results in a noticeable visual glitch and a poor user experience
I tested the exact same code on iOS 18, where the sheet dismisses smoothly and behaves as expected, without any visual artifacts.
Has anyone else encountered this issue on iOS 26?
Is this a known bug, or is there a recommended workaround?
Any insights would be greatly appreciated.
Thank you.
I am developing an iOS application that utilizes running workout data from the iOS Health app / Fitness app via HealthKit, with explicit user permission.
Before finalizing the app design, I would like to clarify several technical aspects related to data reliability, manual entry, record modification, and GPS route availability in HealthKit.
My questions are as follows:
1. Identifying manually added (non-physical) running workouts
When a running workout is created in the Health app without actual physical movement (for example, a workout manually added by the user),
is there any metadata, flag, or key in HealthKit that allows developers to distinguish these records from workouts generated through actual motion tracking (iPhone or Apple Watch)?
2. Editing existing running workout records
Is it possible for users, or for third-party apps with HealthKit write permission, to edit an existing running workout (e.g., distance, duration, calories) after it has been saved?
• If edits are allowed, are the original values preserved in any way, or are they fully overwritten?
3. Detecting modified workout records
If a running workout (whether originally auto-recorded or manually created) has been edited after creation,
is there any identifier, metadata field, source revision, or versioning mechanism in HealthKit that allows developers to detect that the workout has been modified?
4. Access to GPS route / running path data
For outdoor running workouts recorded with location services enabled:
• Does HealthKit provide access to GPS route data (running paths / location traces) associated with a workout?
• Is this route data accessible to third-party apps with user permission?
• Is route data available only for workouts recorded on Apple Watch, or also for iPhone-only recordings?
• Is there a way to determine programmatically whether a running workout includes valid GPS route data?
The overall goal is to understand whether, when building an app that relies on HealthKit running data, it is technically possible to differentiate motion-based workouts from manually added or edited records, and to assess the availability of route information for outdoor runs.
Any clarification or references to official documentation would be greatly appreciated.
Thank you
I'm developing a watchOS nap app that detects when the user falls asleep by monitoring heart rate changes.
== Technical Implementation ==
HKWorkoutSession (.mindAndBody) for background execution
HKAnchoredObjectQuery for real-time heart rate data
CoreMotion for movement detection
== Battery Considerations ==
Heart rate monitoring ONLY active when user explicitly starts a session
Monitoring continues until user is awakened OR 60-minute limit is reached
If no sleep detected within 60 minutes, session auto-ends
(user may have abandoned or forgotten to stop)
App displays clear UI indicating monitoring is active
Typical session: 15-30 minutes, keeping battery usage minimal
== The Problem ==
HKWorkoutSession affects Activity Rings during the session. Users receive
"Exercise goal reached" notifications while resting — confusing.
== What I've Tried ==
Not using HKLiveWorkoutBuilder → Activity Rings still affected
Using builder but not calling finishWorkout()
(per https://developer.apple.com/forums/thread/780220)
→ Activity Rings still affected
WKExtendedRuntimeSession (self-care type)
(per https://developer.apple.com/forums/thread/721077)
→ Only ~10 min runtime, need up to 60 min
HKObserverQuery + enableBackgroundDelivery
(per https://developer.apple.com/forums/thread/779101)
→ ~4 updates/hour, too slow for real-time detection
Audio background session for continuous processing
(suggested in https://developer.apple.com/forums/thread/130287)
→ Concerned about App Store rejection for non-audio app;
if official approves this technical route, I can implement in this direction
Some online resources mention "Health Monitoring Entitlement" from WWDC 2019
Session 251, but I could not find any official documentation for this entitlement.
Apple Developer Support also confirmed they cannot locate it?
== My Question ==
Is there any supported way to:
Monitor heart rate in background for up to 60 minutes
WITHOUT affecting Activity Rings or creating workout records?
If this requires a special entitlement or API access, please advise on
the application process. Or allow me to submit a code-level support request.
Any guidance would be greatly appreciated. Thank you!
Topic:
App & System Services
SubTopic:
Health & Fitness
Tags:
Entitlements
Health and Fitness
HealthKit
Hi!
I have over 800 days strike in closing my move circle. However oerfect month badge is not popping up for November, we have now mid of Dec and still no update.
I updated iOS to 26, did multiple resets and hard resets and still no badge. I checked many forums and post but any of given tips is working in my case.
i know it sounds funny, but it’s frustrating that I’m not getting this little gold medal to keep me motivated 😅
does anyone know how to deal with it? Is it common issue?
I am developing a running training app that coaches can use to create interval workout plans.
I can use HKWorkout to get information about Splits similar to that in Fitness app, but I can't get information about Intervals.
My idea is to show interval details when users view their completed custom interval workout plans.
Can I use Healthkit (or another feasible method) to get the actual distance or time of exercise in intervals workout ?
(I know the workoutPlan property, but it doesn't reflect the segments of a real interval training workout.)
Any insights or suggestions would be greatly appreciated!
Thanks in advance!
Topic:
App & System Services
SubTopic:
Health & Fitness
Tags:
Health and Fitness
HealthKit
WorkoutKit
Was able to use ai to help code my idea for a haptic heart rate monitor using watch se‘s ppg and accelerometer. Now if I could just get it on the App Store…
The second time i start a workout session, the beginCollection instance method on HKLiveWorkoutBuilder freezes.
To recreate run the Apple Sample Project Building a multidevice workout app. It looks like a bug with the HealthKit SDK and not the code but i could be wrong. The only workaround i found was erasing the simulator and reinstalling the app.
When calling beginCollection on HKLiveWorkoutBuilder the function never completes and gets stuck. (On the second workout session, the first session works flawlessly)
To reproduce:
Run the MirroringWorkoutsSample on WatchOS https://developer.apple.com/documentation/healthkit/building-a-multidevice-workout-app.
Start the workout and then end the workouts it should work perfectly fine the first time.
Start the workout and end again, and you should see the problem, the workout doesn’t end.
I am the developer of a workout app that allows users to create interval programs (e.g. Warm Up, Fast, Cool Down).
It is possible for me to store the data for the intervals along with the workout in the Health system by using WorkoutKit (or any other method)?
My aim is to make it so that the Fitness app shows the interval details when users view workouts created by my app.
Thanks in advance.
I am using this below code since WatchOS 10 to set the user steps observer and get the callback of steps whenever changes.
This is still working perfectly fine till watchOS 11 but when i updated to watchOS 26.1, I am not getting the callback of steps, like the observer is not working at all. I should get a callback inside query block whenever user take steps, but it is not working in watchOS 26.1.
func setupStepCountObserver(completion: @escaping (Double, Double) -> Void) {
let stepCountType = HKObjectType.quantityType(forIdentifier: .stepCount)!
let query = HKObserverQuery(sampleType: stepCountType, predicate: nil) { [weak self] _, completionHandler, error in
if let error = error {
print("Error setting up observer query: \(error.localizedDescription)")
return
}
// Fetch the latest step count data
self?.getLast20SecTodaysSteps(completion: completion)
// Call the completion handler to let HealthKit know you have processed the update
completionHandler()
}
// Execute the query
healthStore.execute(query)
// Enable background delivery of updates
healthStore.enableBackgroundDelivery(for: stepCountType, frequency: .immediate) { success, error in
if let error = error {
print("Error enabling background delivery steps: \(error.localizedDescription)")
} else if success {
print("Background delivery enabled for steps.")
}
}
}
Hi everyone,
we’re developing an app that lets users export selected bike rides to the HealthKit ecosystem. We created our app icon using the Apple Icon Composer and referenced the composer file in Xcode. Everything works fine, except that the logo doesn’t appear correctly in the Fitness app.
Has anyone experienced this issue or knows how to fix it?
Topic:
App & System Services
SubTopic:
Health & Fitness
Tags:
Health and Fitness
HealthKit
Icon Composer
Ever since upgrading to OS 26.1, I've noticed that HealthKit anchored object queries seem to be much slower-updating than normal. I was curious if Apple stated anything explicitly changed on this front? I use anchored object queries to update some of the workout metrics that HKLiveWorkoutBuilder doesn't report (like stepCount).
Can’t get the live data from ppg sensor (se os 26.x) for 0 latency parsing of haptics per each pulse (heart beat). any help would be cool.
b
I am working on a cycling fitness app and I want to read the cycling power recorded using my Garmin edge from the Garmin Connect App. Currently the data is not transferred to the Health/Fitness Apps. Ideally it would be good to be able to query the power samples similar to the heart rate samples, but even the average power would suffice, as I could then calculate the Kilojoules.
Hi everyone,
I’m building a health app with React Native using Expo Dev Client on a real iPhone. I need to read Apple Health (HealthKit) data, but the authorization sheet never appears—so the app never gets permissions and all queries return nothing.
What I’ve already done
Enabled HealthKit capability for the iOS target.
Added NSHealthShareUsageDescription and NSHealthUpdateUsageDescription to Info.plist.
Using a custom dev build (not Expo Go).
Tested fresh installs (deleted the app), rebooted device, and checked Settings → Privacy & Security → Health/Motion & Fitness.
Tried both packages: react-native-health and @kingstinct/react-native-healthkit. Same behavior: no permission dialog at first use.
Ask
Is there a known reason why the HealthKit permission sheet would not show on modern iOS when called from a React Native bridge (with Expo Dev Client)? Are there any extra entitlements, signing, or config-plugin steps required beyond HealthKit capability + Info.plist?
If you’re successfully fetching Apple Health data from React Native on recent iOS, could you share the exact steps that made the permission sheet appear and data flow (Expo config/plugin used, Xcode capability setup, profile/team settings, build type, bundle ID nuances, any Health app reset steps, etc.)? This would help me and others hitting the same “authorized call but no prompt/no data” issue. Thank you!
I'm trying to make a watchOS app that uses sleep data to wake users up when they enter lighter sleep stages. Apple has HealthKit, which exposes HKCategoryValueSleepAnalysis to view each stage throughout sleep, but unfortunately, this data is only written after the user wakes up.
I did some research and found that the Apple Watch’s sleep classifier is part of Apple’s private system process, and apps can’t access that model directly or as it’s running. So, there’s no way to “record” my own data stream and match it with Apple’s classification during the night.
Has anyone found a way to approximate or access live sleep-stage data in another way?
I’m thinking of combining CoreMotion (for movement) and heart rate data from a HKWorkoutSession to infer stages myself, but I’m wondering if there’s any Apple-approved or more accurate approach for this.
In other words, is there any way to use an Apple Watch to detect sleep stages accurately while the user is still asleep for the purpose of timing an optimal wake-up? Thanks
Current HealthKit APIs provide access to heart-rate data through queries, but not as a true real-time stream. This limitation prevents systems such as Mercedes-Benz ENERGIZING from dynamically adapting the vehicle environment — including light, sound, seat massage and climate — to the driver’s physiological state.
The ENERGIZING Coach developed by Mercedes-Benz uses continuous biometric feedback to enhance comfort, focus and safety by adjusting sensory stimuli based on live pulse data. Garmin wearables can already support this because they offer open Bluetooth Low Energy protocols. The Apple Watch, on the other hand, stores heart-rate data securely in HealthKit and makes it available through delayed write intervals. As a result, the current query mechanisms such as HKAnchoredObjectQuery or HKObserverQuery deliver updates with a latency of several seconds to minutes, which is too slow for the type of sub-second reaction required by driver-assistance or wellness systems.
I would like to propose that Apple consider creating a real-time HealthKit streaming entitlement for verified partners such as automotive manufacturers participating in the CarPlay ecosystem. This entitlement could be limited to specific biometric signals like heart rate, heart-rate variability and stress index, and should function only when the user explicitly opts in. The data could travel one way from the iPhone to the vehicle head unit during an active CarPlay session, remain local and encrypted, and never be stored in the cloud. A latency of around half a second would be ideal. Technically, this could follow an asynchronous delegate model similar to HKLiveWorkoutBuilder or a Combine publisher interface adapted for CarPlay Health sessions.
A capability like this would extend Apple’s health ecosystem beyond the wrist into the driving environment, allowing cars to respond in real time to the physical state of their drivers. It would strengthen Apple’s commitment to both privacy and safety, while supporting automotive partners that focus on human-centered design. Imagine a driver whose heart rate drops below a vigilance threshold: the Apple Watch detects it instantly, CarPlay transmits the signal securely to the ENERGIZING system, and the vehicle gently adjusts lighting and seat vibration to restore alertness.
This kind of integration fits perfectly with Apple’s long-term vision of “Health Everywhere” and would make a measurable contribution to road safety and driver well-being. I would be happy to provide a more detailed use-case document or to collaborate with the Health Technologies and Car Experience teams to outline how this integration could be implemented securely and efficiently.
Topic:
App & System Services
SubTopic:
Health & Fitness
Hi,
I have a workout app in the App Store which mirrors workout data between the phone and watch.
Since iOS 26.x I've been having issues and received reports of the mirroring no longer working. Users in iOS 18 have no problems with this functionality.
Bug description: A workout session is started from the phone app and starts mirroring to the watch companion device. The watch starts the workout session and then the mirroring session is disconnected / lost. Sending data to the companion device fails and ending the session on the phone doesn't end the session on the watch...essentially they become completely disconnected.
Please note I am testing this on physical devices...not simulators.
As a sanity check I've also tried the "Building a multidevice workout app" sample code and it has the same problem.
To re-create on the sample app, I start a workout from the phone, the watch workout starts and then the mirroring session seems to disconnect and is unable to send data.
This is the log from the "Building a multidevice workout app" sample code.
Successfully started workout
Type: Notice | Timestamp: 2025-10-17 06:57:07.341401+02:00 | Process: MirroringWorkoutsSample Watch App | Library: MirroringWorkoutsSample Watch App.debug.dylib | Subsystem: com.example.apple-samplecode.MirroringWorkoutsSampleABC123.watchkitapp | Category: MirroringWorkoutsSampleForWatch | TID: 0x1b2ca7
-[SPRemoteInterface _appRecoverAnyExtendedRuntimeSession:]_block_invoke:4350: Got no sessions back from -[CSLSSessionService existingRunningSessions:] or -[CSLSSessionService existingScheduledSessions:] after receiving a PUICInitializeSessionServiceAction
Type: Error | Timestamp: 2025-10-17 06:57:07.641571+02:00 | Process: MirroringWorkoutsSample Watch App | Library: WatchKit | Subsystem: com.apple.watchkit | Category: default | TID: 0x1b2ca7
Session state changed from 1 to 2
Type: Notice | Timestamp: 2025-10-17 06:57:07.647883+02:00 | Process: MirroringWorkoutsSample Watch App | Library: MirroringWorkoutsSample Watch App.debug.dylib | Subsystem: com.example.apple-samplecode.MirroringWorkoutsSampleABC123.watchkitapp | Category: MirroringWorkoutsSampleForWatch | TID: 0x1b2e87
Failed to send data: Error Domain=com.apple.healthkit Code=100 "Failed to send data to remote session." UserInfo={NSLocalizedDescription=Failed to send data to remote session.}
Type: Notice | Timestamp: 2025-10-17 06:57:07.669922+02:00 | Process: MirroringWorkoutsSample Watch App | Library: MirroringWorkoutsSample Watch App.debug.dylib | Subsystem: com.example.apple-samplecode.MirroringWorkoutsSampleABC123.watchkitapp | Category: MirroringWorkoutsSampleForWatch | TID: 0x1b2ca7
Would appreciate any help with this problem as it's affecting customers.
Thank you
We are using HealthKit in our app to synchronize step count data.
The data is correctly synced with the Health app, but the step count does not appear in the Fitness app (although workout data does).
Is there anything developers need to do to synchronize step count data with the Fitness app as well?