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.")
}
}
}
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
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.
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.
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…
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?