New in iOS 26 and WatchOS 26 is a Sleep Score calculation for users based on Duration, Bedtime and Interruptions.
Unfortunately I can't find any APIs for developers to tap into this metric. Yes, in theory it's all created off the same Sleep Analysis data already available with HealthKit but that makes it very hard to recreate in our apps. If the numbers don't match up exactly, users will understandably complain.
Can anyone confirm that this is the case and I've not missed a Sleep Score API? I'll then file feedback.
Hopefully this doesn't go the way of Heart Rate Zones where the Apple Watch iPhone app has generated them for years and provided no way for third party apps to access these values (yes many feedbacks provided previously).
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 -
I'm wondering about the suggested apps listed by Apple in their Health app. For example, if you select the "Sleep" category there are a bunch of suggested apps like AutoSleep and Sleepzy. These are not Sleep apps that I installed on my own phone or ever shared sleep data with.
Is there a way to request to have a relevant app shown there? Or is it more automatic, like you're an app that integrates with HealthKit in certain ways and Apple has a way of determining that app is suitable for the user (ex. App Store popularity, user behavior, etc.)
Are there any HealthKit related changes to be aware of in the new update that enables SPO2 / Blood Oxygen Saturation measurements on certain Apple Watch models within the US?
I’m aware of processing happening on the phone…. But beyond that:
Does this mean values are then saved to Apple Health?
Do these models still take background SPO2 measurements in the same way as other models do?
Are these values then visible in third party iOS apps as normal through HealthKit?
Do these values sync back to the paired Apple Watch HealthKit store for third party apps to access on the Watch?
For reference I have an iOS and WatchOS app that, amongst other features, provides the ability to see your SPO2 values in the Watch app, complications and in the iOS app.
Topic:
App & System Services
SubTopic:
Health & Fitness
Tags:
WatchKit
Health and Fitness
watchOS
HealthKit
watchos 26 新增了睡眠评分,开发者如何获取这个评分,有相关的文档和API吗?
Watchos 26 has added a sleep rating. How can developers obtain this rating? Do you have any relevant documentation and APIs?
Topic:
App & System Services
SubTopic:
Health & Fitness
I have recently come across a couple of odd HealthKit step samples from WatchOS. They represent step data measured in 2022 by my Apple Watch, but they have a creation date ("Date Added to Health") within the past couple of days. These odd samples show a "View All Quantities" button at the bottom of the sample Details page in the Health app on iOS 26 (which I've never seen before); the button leads to a list of many small step quantities, almost as if some older, smaller samples were consolidated into these newer samples.
Even weirder is that at least some of these samples seem to be getting re-created repeatedly. For example, I've seen the same sample with a "Date Added to Health" of 9/5/25, then 9/8/25, twice on 9/9/25, and twice on 9/10/25.
These samples were originally created by WatchOS 9, and are not being deleted/recreated by any apps on my device. I have only observed it since I updated to the iOS 26 beta (and now the RC); my watch was still running iOS 18 the first time it happened, but it has also happened since my watch was updated to WatchOS 26 beta.
I did some debug printing of the odd samples and the normal samples surrounding them for comparison.
Here's a normal sample:
Sample: 80AC5AC5-CBD7-4581-B275-0C2ACA35B7B4 6 count 80AC5AC5-CBD7-4581-B275-0C2ACA35B7B4, (9.0), "Watch6,1" (9.0) "Apple Watch" (2022-09-15 16:20:14 -0500 - 2022-09-15 16:20:16 -0500)
Device: <<HKDevice: 0x10591eee0>, name:Apple Watch, manufacturer:Apple Inc., model:Watch, hardware:Watch6,1, software:9.0, creation date:2022-08-25 18:22:26 +0000>
Source revision: <HKSourceRevision name:My Apple Watch, bundle:com.apple.health.EE83959D-D009-4BA0-83A5-2E5A1CC05FE6, version:9.0, productType:Watch6,1, operatingSystemVersion:9.0>
Source: <HKSource:0x110588690 "My Apple Watch", bundle identifier: com.apple.health.EE83959D-D009-4BA0-83A5-2E5A1CC05FE6, localDeviceSource: 0, modification date: 2024-01-31 05:49:18 +0000>
Date added: 2022-09-15 21:20:16 +0000
Days between end and add: 0
And here's one of the odd samples:
Sample: 4982487F-1189-4F16-AB00-61E37818A66D 676 count 4982487F-1189-4F16-AB00-61E37818A66D, (9.0), "iPhone12,1" (16.2) "Apple Watch" metadata: {
HKMetadataKeySyncIdentifier = "6:38082859-D9C8-466A-8882-53443B2A2D94:684969619.25569:684970205.31182:119";
HKMetadataKeySyncVersion = 1;
} (2022-09-15 16:20:19 -0500 - 2022-09-15 16:30:05 -0500)
Device: <<HKDevice: 0x10591ce40>, name:Apple Watch, manufacturer:Apple Inc., model:Watch, hardware:Watch6,1, software:9.0, creation date:2022-08-25 18:22:26 +0000>
Source revision: <HKSourceRevision name:My Apple Watch, bundle:com.apple.health.EE83959D-D009-4BA0-83A5-2E5A1CC05FE6, version:9.0, productType:iPhone12,1, operatingSystemVersion:16.2>
Source: <HKSource:0x110588640 "My Apple Watch", bundle identifier: com.apple.health.EE83959D-D009-4BA0-83A5-2E5A1CC05FE6, localDeviceSource: 0, modification date: 2024-01-31 05:49:18 +0000>
Date added: 2025-09-08 21:11:12 +0000
Days between end and add: 1088
Here's that same odd sample a day later, apparently recreated:
Sample: 9E8B12FC-048D-4ECD-BE5B-D387AADE5130 676 count 9E8B12FC-048D-4ECD-BE5B-D387AADE5130, (9.0), "iPhone12,1" (16.2) "Apple Watch" metadata: {
HKMetadataKeySyncIdentifier = "6:38082859-D9C8-466A-8882-53443B2A2D94:684969619.25569:684970205.31182:119";
HKMetadataKeySyncVersion = 1;
} (2022-09-15 16:20:19 -0500 - 2022-09-15 16:30:05 -0500)
Device: <<HKDevice: 0x12f01c4e0>, name:Apple Watch, manufacturer:Apple Inc., model:Watch, hardware:Watch6,1, software:9.0, creation date:2022-08-25 18:22:26 +0000>
Source revision: <HKSourceRevision name:My Apple Watch, bundle:com.apple.health.EE83959D-D009-4BA0-83A5-2E5A1CC05FE6, version:9.0, productType:iPhone12,1, operatingSystemVersion:16.2>
Source: <HKSource:0x12f0f8230 "My Apple Watch", bundle identifier: com.apple.health.EE83959D-D009-4BA0-83A5-2E5A1CC05FE6, localDeviceSource: 0, modification date: 2024-01-31 05:49:18 +0000>
Date added: 2025-09-09 20:53:18 +0000
Days between end and add: 1089
It's worth pointing out some differences between the "normal" and "odd" samples (besides the "View All Quantities" button in the Health app). The recreated "odd" samples have a different Source Revision - the "productType" and "operatingSystemVersion" refer to my iPhone, not the Apple Watch device that actually captured the samples. The odd samples also have metadata keys that don't exist in the other samples - HKMetadataKeySyncIdentifier and HKMetadataKeySyncVersion.
Questions I'm hoping someone can help with:
What are these samples? Why/how do they have a "View All Quantities" button that shows sub-samples?
Is this new to iOS 26?
Why are some of the samples getting recreated multiple times?
Overview of Issue
My implementation of HealthKit is no longer able to read values due to authorization issues (ex. "HealthKitService: Not authorized to read HKQuantityTypeIdentifierHeight. Status: 0"). I have been through every conceivable debugging step including building a minimal project that just requests HealthKit data and the issue has persisted. I've tried my personal as well as Organizational developer teams. My MacOS and Mac Mini. Simulator and personal device. Rechecked entitlements, reprovisioned certificates. This makes no sense. And I have been unable to find anything similar in the Developer forums or documentation.
The problem occurs during the onboarding flow when the app requests HealthKit permissions. Even when the user grants permission in the HealthKit authorization sheet, the authorizationStatus for characteristic data types (like Biological s3x and Date of Birth) and quantity data types (like Height and Weight) consistently returns as .sharingDenied. This prevents the app from pre-filling the user's profile with their HealthKit data, forcing them to enter it manually.
The issue seems to be environmental rather than a specific code bug, as it has been reproduced in a minimal test case app and persists despite extensive troubleshooting.
Minimal test project: https://github.com/ChristopherJones72521/HealthKitTestApp**
STEPS TO REPRODUCE
Build app, attempt to sign in. No data is imported into the respective fields in the main app. Console logs confirm.
PLATFORM AND VERSION
iOS
Development environment: Xcode Version 16.4 (16F6), macOS 15.5 (24F74)
Run-time configuration: iOS 18.5
Relevant Code Snippets
Here are the key pieces of code that illustrate the implementation and the problem:
1. Requesting HealthKit Permissions (HealthKitService.swift)
This function is called to request authorization for the required HealthKit data types. The typesToRead and typesToWrite are defined in a centralized HealthKitTypes struct.
// HealthKitService.swift
func requestPermissions(completion: @escaping (Bool, Error?) -> Void) {
guard HKHealthStore.isHealthDataAvailable() else {
completion(false, HealthKitError.notAvailable)
return
}
let typesToRead: Set<HKObjectType> = [
HKObjectType.characteristicType(forIdentifier: .dateOfBirth)!,
HKObjectType.characteristicType(forIdentifier: .biologicals3x)!,
HKObjectType.quantityType(forIdentifier: .height)!,
HKObjectType.quantityType(forIdentifier: .bodyMass)!
]
let typesToWrite: Set<HKSampleType> = [
HKObjectType.workoutType(),
HKObjectType.quantityType(forIdentifier: .activeEnergyBurned)!
]
healthStore.requestAuthorization(toShare: typesToWrite, read: typesToRead) { success, error in
DispatchQueue.main.async {
if let error = error {
print("HealthKitService: Error requesting authorization: \(error.localizedDescription)")
completion(false, error)
} else {
print("HealthKitService: Authorization request completed. Success: \(success)")
completion(success, nil)
}
}
}
}
2. Reading Biological s3x (HealthKitService.swift)
This function attempts to read the user's biological s3x. The print statements are included to show the authorization status check, which is where the issue is observed.
// HealthKitService.swift
func readBiologicals3x() async throws -> HKBiologicals3xObject? {
guard HKHealthStore.isHealthDataAvailable() else { throw HealthKitError.notAvailable }
let s3xAuthStatus = healthStore.authorizationStatus(for: HKObjectType.characteristicType(forIdentifier: .biologicals3x)!)
print("HealthKitService: Auth status for Biological s3x: \(s3xAuthStatus.rawValue)")
guard s3xAuthStatus == .sharingAuthorized else {
print("HealthKitService: Not authorized to read Biological s3x.")
throw HealthKitError.notAuthorized
}
do {
return try healthStore.biologicals3x()
} catch {
print("HealthKitService: Error executing biologicals3x query: \(error.localizedDescription)")
throw HealthKitError.queryFailed(error)
}
}
3. Calling HealthKit Functions During Onboarding (OnboardingFlowView.swift)
This is how the HealthKitService is used within the onboarding flow. The requestHealthKitAndPrefillData function is called after the user signs in, and it attempts to read the data to pre-fill the profile form.
// OnboardingFlowView.swift
func readHealthKitDataAsync() async {
print("Attempting to read HealthKit data async...")
// ... (calls to HealthKitService.shared.readDateOfBirth(), readHeight(), etc.)
do {
if let biologicals3xObject = try await HealthKitService.shared.readBiologicals3x() {
if self.selectedGender == nil {
switch biologicals3xObject.biologicals3x {
case .female: self.selectedGender = .female
case .male: self.selectedGender = .male
case .other: self.selectedGender = .other
default:
break
}
}
}
} catch {
print("OnboardingFlowView: Error reading Biological s3x: (error.localizedDescription)")
}
print("OnboardingFlowView: Finished HealthKit data processing.")
}
Console Logs
Attempting to read HealthKit data async...
HealthKitService: Reading Date of Birth...
HealthKitService: Current auth status for DOB (during read attempt): 0
HealthKitService: Not authorized to read Date of Birth. Status: 0
OnboardingFlowView: Error reading Date of Birth: The operation couldn’t be completed. (Strike_Force.HealthKitError error 2.)
HealthKitService: Reading Height...
HealthKitService: Current auth status for HKQuantityTypeIdentifierHeight (during read attempt): 0
HealthKitService: Not authorized to read HKQuantityTypeIdentifierHeight. Status: 0
OnboardingFlowView: Error reading Height: The operation couldn’t be completed. (Strike_Force.HealthKitError error 2.)
HealthKitService: Reading Weight (Body Mass)...
HealthKitService: Current auth status for HKQuantityTypeIdentifierBodyMass (during read attempt): 0
HealthKitService: Not authorized to read HKQuantityTypeIdentifierBodyMass. Status: 0
OnboardingFlowView: Error reading Weight: The operation couldn’t be completed. (Strike_Force.HealthKitError error 2.)
HealthKitService: Pre-read check for Biologicals3x auth status: 1 (Denied)
HealthKitService: Reading Biological s3x...
HealthKitService: Current auth status for Biological s3x (during read attempt): 1
HealthKitService: Not authorized to read Biological s3x. Status: 1
OnboardingFlowView: Error reading Biological s3x: The operation couldn’t be completed. (Strike_Force.HealthKitError error 2.)
HealthKit is currently not supported on macOS nor tvOS, despite being supported by visionOS. Support for macOS was last asked about[1] here in 2018.
My goal is to display interactive data visualisations over workouts collected in HealthKit on macOS. Will this be possible to do in the near future using HealthKit directly?
If not, can I somehow read the information from an iPhone and display it on the mac?
Cheers,
Rodrigo
[1] https://developer.apple.com/forums/thread/94937
Hello, everyone!
I'm seeking some guidance on the App Store review process and technical best practices for a watchOS app.
My goal is to create an app that uses HealthKit to continuously monitor a user's heart rate in the background for sessions lasting between 30 minutes and 3 hours. This app would not be a fitness or workout tracker.
My primary question is about the best way to achieve this reliably while staying within the App Store Review Guidelines.
Is it advisable to use the WorkoutKit framework to start a custom, non-fitness "session" for the purpose of continuous background monitoring?
Are there any other recommended APIs or frameworks for this kind of background data collection on watchOS that I should be aware of?
What are the key review considerations I should be mindful of, particularly regarding Guideline 4.1 (Design) and the intended use of APIs?
My app's core functionality would require this kind of data for a beneficial purpose. I want to ensure my approach is technically sound and has the best chance of a successful review.
Any insights or advice from developers who have experience with similar use cases would be incredibly helpful!
Thank you!
Topic:
App & System Services
SubTopic:
Health & Fitness
Tags:
SensorKit
Health and Fitness
watchOS
Watch Complications
If a user selects custom structured workout in the apple watch Workout app and records a run with intervals, how can my third party app pull in that data?
I can obviously get the workout and health stuff like heart rate, but I cannot find how to save the intervals and the relevant data.
The workout events are not seemingly helpful - segments are not obviously related to this.
Is it possible? Is it only possible to have the third party app create a customworkout with metadata and then our third party app parses the interval distance/time based on our own structure?
I think this stuff should be able to be accessed.
I'm a bit confused as to what we're supposed to be doing to support starting a workout using Siri in iOS/watchOS 26. On one hand, I see a big push to move towards App Intents and shortcuts rather than SiriKit. On the other hand, I see that some of the things I would expect to work with App Intents well... don't work. BUT - I'm also not sure it isn't just developer error on my part.
Here are some assertions that I'm hoping someone more skilled and knowledgable can correct me on:
Currently the StartWorkoutIntent only serves the Action button on the Watch Ultra. It cannot be used to register Shortcuts, nor does Siri respond to it.
I can use objects inherited from AppIntent to create shortcuts, but this requires an additional permission to run a shortcut if a user starts a workout with Siri.
AppIntent shortcuts requires the user to say "Start a workout in " - if the user leaves out the "in " part, Siri will not prompt the user to select my app.
If I want to allow the user to simply say "Start a Workout" and have Siri prompt the user for input as to which app it should use, I must currently use the older SiriKit to do so.
Are these assertions correct - or am I just implementing something incorrectly?
Using the latest Xcode 26 beta for what it is worth.
Topic:
App & System Services
SubTopic:
Health & Fitness
Tags:
Siri and Voice
SiriKit
Intents
App Intents
Hello. I have implemented background delivery for detecting changes in health kit with HKObserverQuery. It works well, I am reading changes. And I am sending this changes to an https endpoint with using an URLSession.shared.dataTask inside the HKObserverQuery callback while my app is terminated. I have several questions about this:
Is starting a URLSession.shared.dataTask inside HKObserverQuery callback when app is terminated is correct way to do it?
I am calling HKObserverQuery completion handler whatever dataTask returned success or failure but I am wondering what if the network connection is low and this dataTask response could not received in 2-3 seconds. I have read background deliveries should take 1-2 seconds. Should I use an URL session with background configuration for sending those HTTPS requests? If so, should I use download task or upload task (they don't fit my requirements I am sending a simple json)?
Hello. I have implemented background delivery for detecting changes in health kit with HKObserverQuery. It works well, I am reading changes. And I am sending this changes to an https endpoint with using an URLSession.shared.dataTask inside the HKObserverQuery callback while my app is terminated. I have several questions about this:
Is starting a URLSession.shared.dataTask inside HKObserverQuery callback is correct way to do it?
I am calling HKObserverQuery completion handler whatever dataTask returned success or failure but I am wondering what if the network connection is low and this dataTask response could not received in 2-3 seconds. I have read HealthKit background deliveries should take 1-2 seconds.
Should I use background task somehow for sending those HTTPS requests?
I updated my watch to take advantage of the reactivated blood oxygen/O2 function, but with my iPhone on public beta 3, it still shows unavailable. Will there be an update to beta three to allow this newly reactivated Apple Watch feature to function?
Hi,
My app concept features various sections;
a) Personal development section: featuring exercises and guides,
b) Coaches section: featuring coaching sessions offering virtual or in-person sessions related to yoga, fitness, lifestyle etc. (marketplace for coaches).
c) Events section: hosting virtual or in-person events.
Hence which "tax category" should I be selecting?
Thanks,
Gavin
Topic:
App & System Services
SubTopic:
Health & Fitness
Hi guys,
We have an app that consumes data from Apple HealthKit. We use an HKObserverQuery to monitor changes in HealthKit data, and occasionally use regular HKSampleQuery requests when the app is in the foreground.
Over the past few weeks, we’ve been encountering a significant number of errors when requesting additional HealthKit permissions (beyond what the user has already granted). The error message we’re seeing is:
The operation couldn't be completed. (_UIViewServiceInterfaceErrorDomain error 2.)
When this error occurs, all previously granted HealthKit permissions are automatically revoked, which is highly disruptive.
We have a few questions and would greatly appreciate any insights or explanations regarding this behavior:
Could this error occur if a permission request is triggered right as the app moves to the background?
Why would previously granted permissions be revoked automatically after this error?
If this is due to some internal behavior in iOS (e.g., a system-level protection or timeout), is there any known workaround or best practice to prevent this from happening?
Thanks in advance for your help!
Looking for help with our Apple HealthKit integration. We've successfully pulled steps, distance, active energy, glucose and heart rate. However, the data pulled for sleep duration is incorrect. Not sure what we're doing wrong.
Hello,
What is the best practice for sending customized workouts to the Apple Watch.
For example, sending a running workout that entails:
Run 1 mile at 8:00/mile
Walk 2 minutes
Run 2 mile at 7:00/mile ----
Walk 2 minutes ----
Repeat 2x
Run 1 mile at 8:00/mile
Any documentation or sample codes would be amazing. Thank you
In iOS 26, HKLiveWorkoutBuilder is supported, which we can use like HKWorkoutSession in watchOS - this is very exciting.
However, it currently seems to have a bug in calculating calories.
I tested it in my app, and for nearly 6 minutes with an average heart rate of 134, it only calculated 8 calories consumed (80 calories per hour), including basal consumption, which is obviously incorrect.
(I used Powerboats Pro 2 connected to my phone, which includes heart rate data, and HKLiveWorkoutBuilder correctly collected the heart rate, which is great.)
I think my code is correct.
func workoutBuilder(_ workoutBuilder: HKLiveWorkoutBuilder, didCollectDataOf collectedTypes: Set<HKSampleType>) {
for type in collectedTypes {
guard let quantityType = type as? HKQuantityType else {
return // Nothing to do.
}
let statistics = workoutBuilder.statistics(for: quantityType)
if let statistics = statistics {
switch statistics.quantityType {
case HKQuantityType.quantityType(forIdentifier: .heartRate):
/// - Tag: SetLabel
let heartRateUnit = HKUnit.count().unitDivided(by: HKUnit.minute())
let value = statistics.mostRecentQuantity()?.doubleValue(for: heartRateUnit)
let roundedValue = Double( round( 1 * value! ) / 1 )
if let avg = statistics.averageQuantity()?.doubleValue(for: heartRateUnit) {
self.avgHeartRate = avg
}
self.delegate?.didUpdateHeartBeat(self, heartBeat: Int(roundedValue))
case HKQuantityType.quantityType(forIdentifier: .activeEnergyBurned):
let energyUnit = HKUnit.kilocalorie()
let value = statistics.sumQuantity()?.doubleValue(for: energyUnit)
self.totalActiveEnergyBurned = Double(value!)
print("didUpdate totalActiveEnergyBurned: \(self.totalActiveEnergyBurned)")
self.delegate?.didUpdateEnergyBurned(self, totalEnergy: self.totalActiveEnergyBurned + self.totalBasalEneryBurned)
return
case HKQuantityType.quantityType(forIdentifier: .basalEnergyBurned):
let energyUnit = HKUnit.kilocalorie()
let value = statistics.sumQuantity()?.doubleValue(for: energyUnit)
self.totalBasalEneryBurned = Double(value!)
print("didUpdate totalBasalEneryBurned: \(self.totalBasalEneryBurned)")
self.delegate?.didUpdateEnergyBurned(self, totalEnergy: self.totalActiveEnergyBurned + self.totalBasalEneryBurned)
return
default:
print("unhandled quantityType=\(statistics.quantityType) when processing statistics")
return
}
}
I think I've found the source of the problem:
let workoutConfiguration = HKWorkoutConfiguration()
workoutConfiguration.activityType = .traditionalStrengthTraining //walking, running is ok
workoutConfiguration.locationType = .outdoor
When I set the activityType to walking or running, the calorie results are correct, showing several hundred calories per hour.
However, when activityType is set to traditionalStrengthTraining or jumprope, the calculations are incorrect.
PS:
I'm currently using Xcode 26 beta3 and iOS 26 beta3.
Hope this issue can be resolved. Thanks.
I'm using following filters to fetch swimming activities from HealthKit.
For some users it fetches all workouts (pool && open water) but for other it skips some open water activities. See screenshot, all those swimming activities are not fetched by following code.
let startDate = Calendar.current.date(byAdding: .month, value: -1, to: Date())!
let endDate = Date()
let swimmingPredicate = HKQuery.predicateForWorkouts(with: .swimming)
let timePredicate = HKQuery.predicateForSamples(withStart: startDate, end: endDate, options: .strictStartDate)
let predicate = NSCompoundPredicate(andPredicateWithSubpredicates: [swimmingPredicate, timePredicate])
let query = HKSampleQuery(sampleType: .workoutType(),
predicate: predicate,
limit: HKObjectQueryNoLimit,
sortDescriptors: [.init(keyPath: \HKSample.startDate, ascending: false)],
resultsHandler: { [weak self] query, samples, error in
...
Could someone help with ideads what is missing in this case?
Has anyone seen the workout buddy options on watch OS yet? I am not able to get it on my watch.
My setup is an iPhone 16 and Watch Ultra 1 with the 26 OS
I am currently using beta 3.
English US language on both and US as region.
I am located in Germany though.
I restarted both devices multiple times without any changes.
Hopefully someone can help.
Topic:
App & System Services
SubTopic:
Health & Fitness
Tags:
Health and Fitness
watchOS
Apple Watch
WorkoutKit