HealthKit

RSS for tag

Access and share health and fitness data while maintaining the user’s privacy and control using HealthKit.

Posts under HealthKit tag

103 Posts

Post

Replies

Boosts

Views

Activity

HKObserverQuery stops delivering updates in background on watchOS 26
Hello, I’m building a health-related app for both watchOS and iOS, which needs to monitor certain health data (e.g., heart rate, active energy). Before updating to watchOS 26, the queries worked reliably without any issues. However, after adapting to watchOS 26, some users have reported that health data updates stop being delivered. What I’ve observed: HKObserverQuery with enableBackgroundDelivery is set up normally. On WatchOS 26, the query sometimes stops delivering updates entirely after a certain point, and once an update is missed, it may stop delivering further updates completely. Restarting the Apple Watch temporarily restores delivery, but the problem reoccurs after some time. This makes background health data monitoring unreliable for my app. Here’s a simplified version of the code we are using: guard let heartType = HKObjectType.quantityType(forIdentifier: .heartRate) else { return } let query = HKObserverQuery(sampleType: heartType, predicate: nil) { query, completionHandler, error in if let error = error { logEvent("Observer error: \(error.localizedDescription)") return } logEvent("Heart rate changed") MyNotificationManager.shared.sendNotification() // Send a local notification completionHandler() } healthStore.execute(query) healthStore.enableBackgroundDelivery(for: heartType, frequency: .hourly) { success, error in if success { logEvent("Background heart rate delivery enabled") } else { logEvent("Failed to enable background heart rate delivery: \(error?.localizedDescription ?? "Unknown error")") } } Could you please clarify: Is this a known issue with HKObserverQuery and enableBackgroundDelivery on watchOS 26? Are there any recommended workarounds or best practices to ensure continuous background delivery of health data? Thank you in advance for your help.
4
1
145
57m
Rejected using Healthkit
Hi all, I'm developing fitness app and I use healthkit to track user's "STEPS" count from their iphone devices. I have been receiving this rejection and can't seem to get past this: Guideline 2.5.1 - Performance - Software Requirements The app uses the HealthKit or CareKit APIs but does not clearly identify the HealthKit and CareKit functionality in the app's user interface. Apps using these APIs should be clearly indicated to provide transparency and valuable information to users. Next Steps To resolve this issue, it would appropriate to clearly identify the HealthKit and CareKit functionality in the app's user interface. Resources Learn more about software requirements in guideline 2.5.1. I have modified my app: adding user permission prompt, adding healthkit notification, adding healthkit indicator in the UI, adding healthkit information in the onboarding process. I keep getting the same message. When I asked the reviewer what else could be done to satisfy the requirement, I only get boiler plate message above. Anyone know what they really looking for? Any insights is appreciated. Thanks!
0
0
32
9h
How to accurately query HKWorkout segment data
Hello, In my application, I need to obtain precise workout segment data from HKWorkout in order to calculate per-kilometer metrics such as heart rate and pace. My current approach is: 1.Use HKWorkout to fetch the associated HKWorkoutEvents. 2.Take the end time of one event as the start time of the next event to derive per-kilometer segment ranges. The issue I’m facing: •If a user sets Apple Watch to notify every 5 kilometers, then at 5 km, 10 km, 15 km, etc., I see overlapping event times. •From the HKWorkoutEvents data alone, I cannot distinguish between events that represent “per-kilometer splits” and those that represent “5-kilometer notifications.” •As a result, my per-kilometer heart rate and pace calculations can be inaccurate. My question is: Is there a recommended way to reliably differentiate per-kilometer splits from custom distance notifications and ensure accurate segment data retrieval? For example, should I instead reconstruct segments using HKWorkoutRoute and distance samples, rather than relying on HKWorkoutEvents? STEPS TO REPRODUCE 1.On Apple Watch, start an Outdoor Run using the Workout app. 2.In workout notifications, set distance alerts to every 5 kilometers. 3.During the run, when reaching 5 km, 10 km, 15 km, etc., the watch triggers notifications. 4.Query the corresponding HKWorkout from HealthKit and inspect its HKWorkoutEvents. 5.Notice that some event start times are duplicated, and it is unclear which events represent “per-kilometer splits” and which represent “5-kilometer notifications.” Expected Result: Be able to differentiate between per-kilometer splits and custom distance alerts, so that heart rate and pace per kilometer can be calculated accurately. Actual Result: The HKWorkoutEvents data contains duplicated event times without a way to distinguish event types, leading to inaccurate per-kilometer statistics.
2
0
75
23h
Guidance / Documentation on iOS 18.6.1 Blood Oxygen Saturation
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.
7
0
198
1d
Possible to bring back "Time in Bed" iOS feature?
I have an iPhone 11 Pro Max running iOS 26. But since iOS 18, Apple decided to remove the "Time in Bed" feature[1][2]. Is it possible to develop an app that, effectively, "brings back" this feature? It doesn't have to be that accurate. Just a gauge is fine. As a starter I would like to track the time the phone was in Sleep mode (regardless whether the phone is being used). I have a minimal programming background but have not developed an iOS app before so any help would be appreciated. I found out about HealthKit[3] which lets me access (edit?) Health data, but I don't know where to go from there. [1] https://www.reddit.com/r/iOSBeta/comments/1em8bl6/ios_181_db1_time_in_bed_via_iphone_feature_removed [2] https://www.reddit.com/r/ios/comments/1fkjat4/apple_removed_the_iphoneonly_sleep_tracking [3] https://developer.apple.com/documentation/healthkit
0
0
87
2d
Apple Watch stuck on "Copying shared cache symbols" – blocks real-time testing via Xcode
Hi everyone, I’m a student developer currently building a watchOS app that uses HealthKit and HKWorkoutSession to estimate core body temperature from real-time heart rate data. The app runs well in the simulator, but testing on a physical Apple Watch has been extremely difficult. Each time I try to run the app from Xcode (Version 16.3), the build gets stuck on: “Copying shared cache symbols from MyWatchName (0% completed)” Sometimes it just stops stating connection failure. However, more often no errors are shown, but the sync never finishes. I’ve tried the following without success: Restarting the watch, iPhone, and Xcode Switching networks (Wi-Fi and hotspot) USB wired pairing Resetting developer settings and trust prompts Deleting derived data Rebuilding the project This is especially limiting for a real-time health tracking app where I need to monitor HKLiveWorkoutBuilder data while the screen sleeps — which can’t be tested effectively in the simulator.
2
1
189
1w
What’s the expected frequency of HealthKit enableBackgroundDelivery: HKCategoryTypeIdentifier.sleepAnalysis
Hello, I have enabled HealthKit background delivery for sleep analysis samples: private func setupSleepDataBackgroundDelivery() { if let sleepType = HKObjectType.categoryType(forIdentifier: HKCategoryTypeIdentifier.sleepAnalysis) { healthStore.enableBackgroundDelivery(for: sleepType, frequency: .immediate) { (success, error) in } } } In general, this function works. But I would love to know what the limitations / expected delivery delay for frequency: .immediate is. The documentation is only very vague about this and specifies that some sample types such as steps are only delivered once per hour. But how about sleep data? Is this expected to be delivered immediately once available on iPhone? Thanks a lot for your help!
2
2
192
1w
Using HealthKit to display data on CarPlay UI
I'd like to investigate creating a safety feature for Type 1 Diabetics driving a car. Allowing HealthKit glucose data (read from a Dexcom G7 or similar) to be displayed as part of the CarPlay UI background or show an icon/button with the number visible. I'd also like to include a warning system for glucose low's that alerts the driver audibly. Has anyone looked into that before?
1
0
196
1w
Sleep Score API access
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).
3
1
171
1w
What determines which suggested apps are listed in Health?
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.)
1
0
85
2w
Old HealthKit samples from WatchOS getting deleted and recreated years later
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?
2
0
99
2w
Extremely persistent HealthKit read permissions issue
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?) -&gt; Void) { guard HKHealthStore.isHealthDataAvailable() else { completion(false, HealthKitError.notAvailable) return } let typesToRead: Set&lt;HKObjectType&gt; = [ HKObjectType.characteristicType(forIdentifier: .dateOfBirth)!, HKObjectType.characteristicType(forIdentifier: .biologicals3x)!, HKObjectType.quantityType(forIdentifier: .height)!, HKObjectType.quantityType(forIdentifier: .bodyMass)! ] let typesToWrite: Set&lt;HKSampleType&gt; = [ 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 -&gt; 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.)
2
0
187
3w
Is it possible to get Workout intervals and data from third party app via HealthKit or WorkoutKit?
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.
0
0
196
Aug ’25
UIScene.ConnectionOptions.shouldHandleActiveWorkoutRecovery Missing?
According to the WWDC25 Presentation Track workouts with HealthKit on iOS and iPadOS, there is supposed to be a new property for restoring an active workout after a crash on iOS/iPadOS. The developer documentation also supports this. However, this property does not seem to exist in the latest Xcode 26 beta, even in projects targeting iOS 26.0 as the minimum version. Am I missing something? Has this property not been made available yet? It is actually looking like all of the new iOS 26.0 properties are missing UIScene.ConnectionOptions on my system.
3
0
142
Aug ’25
Xcode 26 Beta 5 HealthKit DLYD Symbol Crash
I'm having a problem with Xcode 26 where a symbol bug is causing my app to crash at launch if they are running iOS 17.X This has to do with a HealthKit API that was introduced in iOS 18.1 HKQuantityType(.appleSleepingBreathingDisturbances), I use availability clauses to ensure I only support it in that version. This all worked fine with Xcode 16.4 but breaks in Xcode 26. This means ALL my users running iOS 17 will get at launch crashes if this isn't resolved in the Xcode GM seed. I'll post the code here in case I'm doing anything wrong. This, the HealthKit capability, the "HealthKit Privacy - Health Share Usage Description" and "Privacy - Health Update Usage Description", and device/simulator on iOS 17.X are all you need to reproduce the issue. I've made a feedback too as I'm 95% sure it's a bug: FB19727966 import SwiftUI import HealthKit struct ContentView: View { var body: some View { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, world!") } .padding() .task { print(await requestPermission()) } } } #Preview { ContentView() } func requestPermission() async -> Bool { if #available(iOS 18.0, *) { let healthTypes = [HKQuantityType(.appleSleepingBreathingDisturbances)] var readTypes = healthTypes.map({$0}) let write: Set<HKSampleType> = [] let res: ()? = try? await HKHealthStore().requestAuthorization(toShare: write, read: Set(readTypes)) guard res != nil else { print("requestPermission returned nil") return false } return true } else { return false} }
1
0
97
Aug ’25
HealthKit Background Delivery and URLSession.shared.dataTask
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)?
2
0
93
Aug ’25
Health Kit Background Delivery and URLSession.shared.dataTask
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?
1
0
87
Aug ’25
HealthKit Permission request throws error
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!
2
0
82
Jul ’25
Support for cycling power & cadence sensors in HKWorkoutSession on iOS?
Hi everyone, while testing HKWorkoutSession with HKLiveWorkoutBuilder on iOS 26 Beta (cycling workout), I noticed the following behavior: – Starting a cycling HKWorkoutSession automatically connects to my Bluetooth heart rate monitor and records HR into HealthKit ✅ – However, my Bluetooth cycling power meter and cadence sensor (standard BLE Cycling Power & CSC services) are not connected automatically, and no data is recorded into HealthKit ❌ On Apple Watch, when starting a cycling workout, these sensors do connect automatically and their data is written to HealthKit — which is exactly what I would expect on iOS as well. Question: Is this by design, or is support for power and cadence sensors planned for iOS in the same way as on watchOS? Or do we, as developers, need to implement the BLE Cycling Power and CSC profiles ourselves (via CoreBluetooth) if we want these metrics? Environment: – iOS 26 Beta – HKWorkoutSession & HKLiveWorkoutBuilder (cycling) – Bluetooth HRM connects automatically – BLE power & cadence sensors do not This feature would make it much easier to develop cycling apps with full HealthKit integration, and also create a more consistent user experience compared to watchOS. Thanks for any insights!
2
1
96
Jul ’25