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.
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
Activity
We are seeing an issue where sending data using the asynchronous method HKWorkoutSession.sendToRemoteWorkoutSession(data: Data) will never return in some cases (no success nor failure).
This issue is happening for roughly 5% of Workouts started and will stay broken for the whole workout. The other 95% of the workouts, the connection works flawlessly. This happens on both watchOS 10 and 11, and with phones running iOS 17 or 18. The issue is quite random and not reproducible.
Our app has thousands of workouts a day that use the workout session workout data send, with constant messages being send every few seconds.
In some of those 5% cases the "sendToRemoteWorkoutSession" will throw way later, like 30+ minutes later, if the watch app is awake long enough to capture a log of a failure.
Our code uses the same flow as in the sample project:
https://developer.apple.com/documentation/healthkit/workouts_and_activity_rings/building_a_multidevice_workout_app
Here is some sample code, which is pretty simple.
Setup code:
let workoutSession = try HKWorkoutSession(healthStore: healthStore, configuration: configuration)
workoutSession.delegate = self
activeWorkoutSession?.startMirroringToCompanionDevice { success, error in
print("Mirroring started on companion device: \(success), error: \(error)")
}
workoutSession?.prepare()
then later we send data using the workout session:
do {
print("Will send data")
try await workoutSession.sendToRemoteWorkoutSession(data: data)
print("Successfully sent data") // This nor the error may be called after waiting extensive amounts of time
} catch {
print("Failed to send data, error: \(error)") // This nor the success may be called after waiting extensive amounts of time
}
So far, the only fix is to restart the phone and watch at the same time, which is not a great user experience.
Is anyone else seeing this issue? or know how to fix this issue?
Topic:
App & System Services
SubTopic:
Health & Fitness
Tags:
Watch Connectivity
Health and Fitness
watchOS
WorkoutKit
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
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'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