We are developing a health app that relies on HKObserverQuery and BackgroundDelivery to monitor Heart Rate data. On watchOS 10.6 and 11.6 , these data updates are typically delivered reliably every 8–12 minutes, occasionally exceeding 12 minutes, but generally not longer than 15 minutes. This frequency has been sufficient for the real-time data requirements of our app.
However, after adapting our app to watchOS 26, we noticed that HKObserverQuery triggers much less frequently, with longer and very inconsistent intervals. This issue has had a major impact on our product: data collection for essential features is unreliable, resulting in a greatly diminished user experience on watchOS 26 and making the app essentially useless from the user’s perspective.
Observed Behavior:
HKObserverQuery and BackgroundDelivery are extremely unstable, with trigger intervals frequently exceeding 15 minutes, and sometimes even 20 minutes.
When the user is sedentary, intervals become even longer; there are cases where no heart rate or active energy updates are delivered for 30 minutes, or even over 1 hour.
Request for Support and Guidance:
Have there been any changes to the HKObserverQuery background delivery mechanism on watchOS 26, specifically for Heart Rate and Active Energy data?
If these changes are intentional system optimizations, could you provide guidance or recommended practices to ensure our app can reliably retrieve updates and maintain a smooth experience for users?
Thank you for your support.
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
Hello,
My watchOS app has been performing fine by requesting background app refresh and then requesting any new data from health kit in the background so that the widget can be updated. However, on watchos26 I have been unable to read data in the background, with any query returning zero results. That same data is clearly read just fine while in the foreground. Can anyone assist?
Hello,
I’m developing a HealthKit-based fitness app in React Native that observes step count changes and uploads the latest totals to a remote server.
I’m currently using HKObserverQuery with background delivery enabled (enableBackgroundDelivery(for:frequency:.immediate)), and the behavior works correctly while the app is running in the background or foreground.
Whenever new step data is written to HealthKit, the app wakes up, reads the latest data, and sends it to my HTTPS endpoint using URLSession.shared.dataTask inside the observer callback.
However, I’ve noticed the following issue:
1. If the user swipes up (force-quits) the app from the app switcher, the observer queries stop firing entirely.
2. In this state, even though HealthKit continues collecting step data from the device or Apple Watch, my app no longer receives those background deliveries until the user opens the app again.
What I would like to achieve is:
When the app is terminated (swiped up), and there are new step count updates in HealthKit, my app should still be able to receive those updates or be relaunched to handle them — similar to how some health companion apps continue syncing data and sending notifications even after being force-quit.
So I have a few questions:
Is this limitation expected — i.e., does iOS intentionally block HKObserverQuery background deliveries after a user force-quits the app?
2. Are there any special entitlements, background modes, or Apple-approved mechanisms that allow a health or medical app to continue receiving HealthKit changes even after a force-quit?
3. If not, what is the recommended architecture for apps that need to process HealthKit data continuously and send it to a backend server? For example, should such apps rely on server-side push notifications or CloudKit sync once the user reopens the app?
My current goal is to ensure step count changes are uploaded reliably even if the app is killed, but I want to stay within the system’s supported behaviors and privacy constraints.
Any clarification or guidance from Apple engineers or others who have implemented continuous HealthKit sync (like companion or medical apps) would be greatly appreciated.
Thank you.
Topic:
App & System Services
SubTopic:
Health & Fitness
Tags:
Health and Fitness
HealthKit
Background Tasks
I'm reporting a critical Health data synchronization failure that began immediately after updating from watchOS 18 to watchOS 26.0.2 (stable release) and persists in watchOS 26.1 beta 2.
Bug Description:
Complete failure of Health data sync from Apple Watch to iPhone Health app. All health metrics are being captured and stored locally on the watch but fail to sync to the paired iPhone.
Affected Data Types:
Activity rings (Move, Exercise, Stand)
Heart rate measurements
Sleep tracking data
Workout data
All other HealthKit data points
Environment:
Device: Apple Watch Series 7
Initial failure: watchOS 26.0.2 (23R362) - stable release
Current: watchOS 26.1 beta 2 (23S5052c)
Paired iPhone: iPhone 17 Pro Max, iOS 26.1 beta 2 (23B5052c)
Bluetooth and Wi-Fi connectivity: Normal
Watch pairing status: Connected and functional for all other features
Reproduction:
Updated Apple Watch Series 7 from watchOS 18 to watchOS 26.0.2 on September 30, 2025
Health data sync ceased completely starting October 1, 2025
Issue persists after updating to watchOS 26.1 beta 2 and iOS 26.1 beta 2
Data remains stored locally on watch and is viewable in watch apps
Apple Watch appears as connected data source in Health app but no data transfers
Troubleshooting Performed:
Multiple device restarts (both iPhone and Apple Watch)
Bluetooth/Wi-Fi toggling and reconnection
Verified Privacy > Motion & Fitness > Fitness Tracking and Health enabled on both devices
Confirmed data source priority settings in Health app
Extended charging periods to allow background sync operations
Verified no Low Power Mode restrictions
Impact:
Critical functionality loss for primary Apple Watch use case. Unable to track longitudinal health data, breaking continuity of health records dating back to watchOS 18.
Feedback Submitted:
FB20533870 filed via Feedback Assistant with sysdiagnose from both devices
Questions for Engineering:
Is this a known regression in watchOS 26.0.2 or later builds?
Are there any watchOS 26.1 beta release notes addressing HealthKit sync issues that I should review?
Should I capture additional diagnostic data (e.g., specific console logs, HealthKit database states)?
Is unpairing/re-pairing expected to resolve this, or would that indicate a deeper architectural issue?
Additional Context:
Apple Watch appears in Settings > Bluetooth as connected
Can successfully change watch faces from iPhone
Notifications, Messages, and calls work normally
No previous sync issues prior to watchOS 26.0.2
Senior Apple Support advisor escalation completed; awaiting engineering review
This appears to be a regression introduced in watchOS 26.0.2. Any guidance on additional diagnostics or confirmation of a fix in upcoming builds would be appreciated.
I researched Apple HealthKit Background Delivery documentation but I couldn't find any information about does HK background delivery stay persistent after restarting the device? Do I need to enable background delivery for each health data type on a reboot? Can you enlighten me about this topic.
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
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
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 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.
I'm developing a single target watchOS app that obtains HealthKit information. I have the "Background Delivery" option checked under "Signing & Capabilities" for the watch target. The app does HKObserverQueries in the foreground that work as I would expect. But when I click the Digital Crown to return to clock face, the HKObserverQuery activity stops. I'm using Xcode 15.4, on Mac 14.5 and a Apple Watch Series 4 running 10.5.
In my app the the statisticsUpdateHandler fetches data from the HealthKit when I open the app from sleeping/standby state. This works fine, except when I leave the app running in the foreground and close the phone for an extended period. This triggers the .errorDatabaseInaccessible error. This seems to stop the statisticsUpdateHandler, maybe set it to nil or something similar. What is the proper way to handle the error to keep it running? As shown in the code below I have tried setting the completion data to the current data. But it stills seems to exit, and thus require a complete restart of the app to re-register the update handler.
Thanks
Tommy
Task {
do {
try await healthStore.requestAuthorization(toShare: [], read:healtTypes)
fetchPast14daysData()
} catch {
print("Error requesting access to health data")
}
}
func fetchDiscreteData(startDate: Date, type: HKQuantityTypeIdentifier, completion: @escaping([WorkoutMetric]) -> Void)
{
let datatype = HKQuantityType(type)
let interval = DateComponents(day: 1)
let query = HKStatisticsCollectionQuery(quantityType: datatype, quantitySamplePredicate: nil, options: .discreteAverage, anchorDate: startDate, intervalComponents: interval)
query.initialResultsHandler = { query, result, error in
...
}
query.statisticsUpdateHandler = { query, statistics, result, error in
var lock_error_detected: Bool = false
// Handle errors here.
if let error = error as? HKError {
switch (error.code) {
case .errorDatabaseInaccessible:
lock_error_detected = true
default:
// Handle other HealthKit errors here.
DispatchQueue.main.async {
self.update_error = error.userInfo[NSLocalizedDescriptionKey] as? String
}
return
}
}
var data = [WorkoutMetric]()
if lock_error_detected {
if (type == .heartRateVariabilitySDNN) {
data = self.HRV
} else {
data = self.restingPulse
}
} else {
guard let result = result else {
completion([])
return
}
result.enumerateStatistics(from: startDate, to: Date()) { statistics, stop in
if ( type == .heartRateVariabilitySDNN)
{
let value = Float(statistics.averageQuantity()?.doubleValue(for: .secondUnit(with: .milli)) ?? 0.0)
//print("HRV data \(value)")
if (value > 1)
{
data.append(WorkoutMetric(date: statistics.startDate, Value: value, Average: 0.0))
}
}
else if ( type == .restingHeartRate)
{
let value = Float(statistics.averageQuantity()?.doubleValue(for: .hertzUnit(with: .none)) ?? 0.0)
//print("Resting hearth rate : \(value) at date \(statistics.startDate)")
if (value > 0.01)
{
data.append(WorkoutMetric(date: statistics.startDate, Value: value*60, Average: 0.0))
}
}
}
let _ = calculate_average(days: self.averagePeriod, workouts: &data)
}
completion(data)
}
healthStore.execute(query)
}
extension HealthManager {
func fetchPast14daysData() {
fetchCumulativeData(startDate: Date().daysAgoAligned(days: daysToFetchDataFor), type: .distanceWalkingRunning) { dailyDistance in
DispatchQueue.main.async {
self.distanceData = dailyDistance
}
..
..
Topic:
App & System Services
SubTopic:
Health & Fitness
Hi,
there seems to be two methods to fetch data from HealthKit and calculate statistics on intervals of the data; HKStatisticsCollectionQuery and HKStatisticsCollectionQueryDescriptor.
I am currently using HKStatisticsCollectionQuery, but HKStatisticsCollectionQueryDescriptor seems to do the same, but with very different code setup.
Could anyone provide any advice on which method is preferable?
Will the older HKStatisticsCollectionQuery become obsolete in the near future?
Thanks
Tommy
Topic:
App & System Services
SubTopic:
Health & Fitness
Hi everyone, I need to display a Graph based on Screen-time of apps per hour, from 12Am to 11PM. Am able to get the screen-time data for whole day with each app's total screen-time value.
Am kind of confused how can I get the per hour screen-time of apps. I have applied filter of day
DeviceActivityFilter(
segment: .daily(
during: Calendar.current.dateInterval(
of: .day, for: .now
)!
),
users: .all,
devices: .init([.iPhone, .iPad])
)
Am also using this data to display apps with their usage just like Apple's Screen_time in settings.
I need to display exact same graph just like Apple's screen in phone settings for a Day.
Topic:
App & System Services
SubTopic:
Health & Fitness
Tags:
Family Controls
Device Activity
Screen Time
I want to get the barometric pressure reading from the built-in barometer to display it in my iOS app. When I use CMAltimeter.startRelativeAltitudeUpdates(), my app receives no relative altitude update events, which means I can't view the barometric pressure from the sensor (because that's only contained in CMAltitudeData, not CMAbsoluteAltitudeData. If I use CMAltimeter.startAbsoluteAltitudeUpdates(), I get absolute altitude update events every second or so. NSMotionUsageDescription is set.
I have tried the following things, all of which haven't worked:
Only calling startRelativeAltitudeUpdates() and not startAbsoluteAltitudeUpdates()
Calling CMSensorRecorder.recordAccelerometer(forDuration: 0.1), as suggested in this thread
Calling CMMotionActivityManager.queryActivityStarting(from: .now, to: .now, to: .main), as suggested here
Physically moving my iPhone up and down about 200 feet using an elevator; I see absolute altitude updates which are in line with what's expected, but still receive no relative altitude update events
Calling the same APIs in a watchOS app on an Apple Watch Series 10; I see much less frequent absolute altitude updates, and still no relative altitude updates
I know the barometer sensor is working, because when I move my iPhone up and down even a foot or two indoors, I see an immediate change in the absolute altitude reading that I know wouldn't come from GPS.
This example code, when run on my iPhone 16 Pro running iOS 18.1.1, prints updates started and then updating absolute every second, but doesn't print anything else. The absolute altitude, accuracy, and authentication status fields update (and the auth status shows 3, indicating .authorized), but the relative altitude and pressure fields remain as --.
struct ContentView: View {
@State private var relAlt: String = "--"
@State private var relPressure: String = "--"
@State private var absAlt: String = "--"
@State private var precision: String = "--"
@State private var accuracy: String = "--"
@State private var status: String = "--"
var body: some View {
VStack {
Text("Altitude: \(relAlt) m")
.font(.title3)
Text("Pressure: \(relPressure) kPa")
.font(.title3)
Text("Altitude (absolute): \(absAlt) m")
.font(.title3)
Text("Precision: \(precision) m")
.font(.title3)
Text("Accuracy: \(accuracy) m")
.font(.title3)
Text("Auth status: \(status)")
.font(.title3)
}
.padding()
.onAppear {
let altimeter = CMAltimeter()
startRelativeBarometerUpdates(with: altimeter)
startAbsoluteBarometerUpdates(with: altimeter)
status = CMAltimeter.authorizationStatus().rawValue.formatted()
print("updates started")
}
}
private func startRelativeBarometerUpdates(with altimeter: CMAltimeter) {
guard CMAltimeter.isRelativeAltitudeAvailable() else {
relAlt = "nope"
relPressure = "nope"
return
}
altimeter.startRelativeAltitudeUpdates(to: .main) { data, error in
if let error = error {
print("Error: \(error.localizedDescription)")
return
}
if let data = data {
print("updating relative")
relAlt = String(format: "%.2f", data.relativeAltitude.doubleValue)
relPressure = String(format: "%.2f", data.pressure.doubleValue)
} else {
print("no data relative")
}
}
}
private func startAbsoluteBarometerUpdates(with altimeter: CMAltimeter) {
guard CMAltimeter.isAbsoluteAltitudeAvailable() else {
absAlt = "nope"
print("no absolute available")
return
}
let altimeter = CMAltimeter()
altimeter.startAbsoluteAltitudeUpdates(to: .main) { data, error in
if let error = error {
print("Error: \(error.localizedDescription)")
return
}
if let data = data {
print("updating absolute")
absAlt = String(format: "%.2f", data.altitude)
precision = String(format: "%.2f", data.precision)
accuracy = String(format: "%.2f", data.accuracy)
}
}
}
}
Is this behavior expected? How can I trigger delivery of relative altitude updates to my app?
https://support.apple.com/zh-cn/104959
Our application provides car insurance services. Does Apple have any API related to car accident detection exposed to developers? We want to do something when an iPhone detects a car accident
Topic:
App & System Services
SubTopic:
Health & Fitness
Hello, we want to re-create these graphs and use the raw data for analysis.
We are getting aggregated elevation, heath rate, and pace data, but need to locate the specifics to create these graphs.
Thank you
Topic:
App & System Services
SubTopic:
Health & Fitness
I am building a watchOS app with iOS companion app.
The watch app needs to track the heart rate during the night or while user is sleeping. And the desired frequency of measurement is 0.2Hz (every 5 seconds)
For this I am using the HKWorkout mode with mindAndBody session.
While it works fine, One of the main issue is: after about 6-7 hours of usage, the battery on the watch drains between 40% (Series 9) and 100% (series 7, I think)
My questions:
Are there any other option to track user's heart rate without workout, while the app could be in background?
Another side effect of this workout mode is, Even if we choose not to save the workout in HealthKit, the Activity rings gets populated by this mindAndBody session, which makes it when the user is waking up, the bar is already full, This is not desired.
Is there any option to specify for ActivityRing skips this?
Highly appreciate any help in advance.
Cheers - Prakash
Topic:
App & System Services
SubTopic:
Health & Fitness
Tags:
Watch Connectivity
HealthKit
Battery Life
Good afternoon,
I am working on a workout tracking app. So far everything is working as expected. However, I note that when my workout saves and is visible within the Fitness App, the workout duration is displayed rather than the kCal burned.
What changes are required to be made in order for this to display the kCal in the list of workouts in Fitness rather than duration?
For reference https://developer.apple.com/videos/play/wwdc2021/10009 this was my reference source for workout functionality.
I've been trying to figure out what the bare minimum is required for HKWorkoutBuilder to create a workout that adds time the appleExerciseTime. I couldn't find the documentation for this. This is my code so far.
func createWorkoutSample(
expectedActiveEnergyData: [Double],
expectedExerciseMinutesData: [Double],
calendar: Calendar,
startDate: Date
) async throws -> [HKSample] {
var testData: [HKSample] = []
let workoutConfiguration = HKWorkoutConfiguration()
workoutConfiguration.activityType = .running
workoutConfiguration.locationType = .outdoor
let results = try await withThrowingTaskGroup(of: HKSample?.self) { group in
for (index) in 0..<expectedActiveEnergyData.count {
guard let date = calendar.date(byAdding: .day, value: index, to: startDate) else {
continue
}
group.addTask {
let builder = HKWorkoutBuilder(
healthStore: self.manager.healthStore,
configuration: workoutConfiguration,
device: .local()
)
let endDate = date.addingTimeInterval(expectedExerciseMinutesData[index] * 60)
try await builder.beginCollection(at: date)
let energyType = HKQuantityType.quantityType(
forIdentifier: .activeEnergyBurned
)!
let energyQuantity = HKQuantity(
unit: HKUnit.kilocalorie(),
doubleValue: expectedActiveEnergyData[index]
)
let energySample = HKQuantitySample(
type: energyType,
quantity: energyQuantity,
start: date,
end: endDate
)
return try await withCheckedThrowingContinuation { continuation in
builder.add([energySample]) { (success, error) in
if let error = error {
continuation.resume(throwing: error)
return
}
builder.endCollection(withEnd: endDate) { (success, error) in
if let error = error {
continuation.resume(throwing: error)
return
}
builder.finishWorkout { (workout, error) in
if let error = error {
continuation.resume(throwing: error)
return
}
continuation.resume(returning: workout)
}
}
}
}
}
}
for try await workout in group {
if let workout = workout {
testData.append(workout)
} else {
print("Skipping nil workout result.")
}
}
return testData
}
print("Total samples created: \(results.count)")
return results
}
When I query appleExerciseTime, there are no results. I've looked at the HKWorkoutBuilder documentation, and most of the information expands on adding samples related to the deprecated HKWorkout.
Hi,
I've had trouble for a while now with HealthKit giving me different values if I make the request on iOS and WatchOS.
I am using the exact same method on both with the same parameters but I get vast differences in the results.
The code I am using to call HealthKit on both devices is:
let dateRange = HKQuery.predicateForSamples(withStart: Date().removeMonths(numberOfMonths: 1), end: Date().endOfDay())
let predicate: NSPredicate
predicate = NSCompoundPredicate(type: .and, subpredicates: [dateRange])
let query = HKStatisticsQuery(quantityType: HKQuantityType(.stepCount), quantitySamplePredicate: predicate, options: .cumulativeSum) { _, result, error in
if error != nil {
//print("Error fetching step count, or there is no data: \(error.localizedDescription), \(startDate) -> \(endDate)")
onComplete(0)
return
}
if let result, let sum = result.sumQuantity() {
let stepCount = sum.doubleValue(for: HKUnit.count())
DispatchQueue.main.async {
onComplete(Int(stepCount))
}
}
}
healthStore.execute(query)
}