I want to insert the medication data which is available from ios 26 from my app to apple health kit. I have tried to get the permission to read and write data but app got crashed while I tried to request that permission. Does apple allow to insert the medication data to apple health kit likewise we are able to add other health and fitness data or not?
let healthStore = HKHealthStore()
@available(iOS 26.0, *)
@objc func requestAuthorization(_ resolve: @escaping RCTPromiseResolveBlock,
rejecter reject: @escaping RCTPromiseRejectBlock) {
guard HKHealthStore.isHealthDataAvailable() else {
print("not available ")
return
}
let doseType = HKObjectType.medicationDoseEventType()
let medType = HKObjectType.userAnnotatedMedicationType()
healthStore.requestAuthorization(toShare: [doseType], read: [doseType]) { success, error in
if let err = error { reject("auth_error", err.localizedDescription, err); return }
self.healthStore.requestPerObjectReadAuthorization(for: medType, predicate: nil) { s, e in
if let err2 = e { reject("per_obj_auth", err2.localizedDescription, err2); return }
resolve(["ok": success && s])
}
}
}
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 using HealthKit in our app to synchronize step count data.
The data is correctly synced with the Health app, but the step count does not appear in the Fitness app (although workout data does).
Is there anything developers need to do to synchronize step count data with the Fitness app as well?
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!
Hey everyone
I'm working on a health app that's heavily focused on HRV tracking and analysis, and I'm trying to figure out what's actually possible with AirPods Pro 3 from a developer standpoint. The hardware clearly has a much better heart rate sensor than the previous generation, but I'm hitting some walls when it comes to actually accessing the data I need.
So here's the situation I'm dealing with: When I query HealthKit for HRV samples, I'm not seeing anything coming from AirPods Pro 3. The device is obviously capable of tracking heart rate continuously during workouts and listening sessions, and from what I've read about the hardware, it should theoretically be able to capture the inter-beat intervals needed for HRV calculation. But either that data isn't being processed on-device, or it's just not being made available through the standard HealthKit data types that third-party apps can access.
What I'm really after is either direct HRV metrics (like SDNN, which Apple Watch already provides through HKQuantityTypeIdentifierHeartRateVariabilitySDNN) or even better, access to the raw R-R interval data. With R-R intervals, I could calculate RMSSD, pNN50, and other time-domain and frequency-domain HRV metrics that are super valuable for tracking recovery, autonomic nervous system balance, and stress levels. This would be especially useful since a lot of users wear AirPods during activities when they're not wearing their Apple Watch.
Has anyone managed to find a way to pull this data from AirPods Pro 3? Are there any private frameworks or entitlements I should be looking into? Or is this just fundamentally not exposed to developers at the OS level right now?
I've gone through the HealthKit documentation pretty thoroughly and haven't found anything that specifically addresses this, but I'm wondering if I'm missing something or if there are any known workarounds.
I'm also curious if anyone has heard anything from Apple about future plans to expose this data. It seems like a missed opportunity given how capable the hardware is and how much value developers could provide with access to this physiological data. Would love to hear if anyone else is working on similar features or has insights into the technical limitations here.
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 am the developer of a workout app that allows users to create interval programs (e.g. Warm Up, Fast, Cool Down).
It is possible for me to store the data for the intervals along with the workout in the Health system by using WorkoutKit (or any other method)?
My aim is to make it so that the Fitness app shows the interval details when users view workouts created by my app.
Thanks in advance.
I am developing an iOS application that utilizes running workout data from the iOS Health app / Fitness app via HealthKit, with explicit user permission.
Before finalizing the app design, I would like to clarify several technical aspects related to data reliability, manual entry, record modification, and GPS route availability in HealthKit.
My questions are as follows:
1. Identifying manually added (non-physical) running workouts
When a running workout is created in the Health app without actual physical movement (for example, a workout manually added by the user),
is there any metadata, flag, or key in HealthKit that allows developers to distinguish these records from workouts generated through actual motion tracking (iPhone or Apple Watch)?
2. Editing existing running workout records
Is it possible for users, or for third-party apps with HealthKit write permission, to edit an existing running workout (e.g., distance, duration, calories) after it has been saved?
• If edits are allowed, are the original values preserved in any way, or are they fully overwritten?
3. Detecting modified workout records
If a running workout (whether originally auto-recorded or manually created) has been edited after creation,
is there any identifier, metadata field, source revision, or versioning mechanism in HealthKit that allows developers to detect that the workout has been modified?
4. Access to GPS route / running path data
For outdoor running workouts recorded with location services enabled:
• Does HealthKit provide access to GPS route data (running paths / location traces) associated with a workout?
• Is this route data accessible to third-party apps with user permission?
• Is route data available only for workouts recorded on Apple Watch, or also for iPhone-only recordings?
• Is there a way to determine programmatically whether a running workout includes valid GPS route data?
The overall goal is to understand whether, when building an app that relies on HealthKit running data, it is technically possible to differentiate motion-based workouts from manually added or edited records, and to assess the availability of route information for outdoor runs.
Any clarification or references to official documentation would be greatly appreciated.
Thank you
Why can I use background delivery to realize background notifications when I run the app for the first time, but when I delete the app running in the background, and then reopen the app to run it in the background, there will be no background notification when the data changes?
Hey everyone,
I was wondering if it is possible to access the raw data of the gyroscope and accelerometer of the Airpod 3 pro?
I found different answers online - some say I can only get some processed data, but in the Core Motion documentation it reads as it might be possible to get raw data.
Any clear answer for this one?
Thanks!
1/ Issue Summary
In our application, we use HKObserverQuery together with:HKHealthStore.enableBackgroundDelivery(for:frequency: .immediate)
to enable HealthKit Background Delivery, allowing the system to wake our App Extension in the background to process health data updates.
Under the same app build, identical HealthKit permission configuration, and the same watchOS version, we have observed significant differences in background delivery frequency across different devices.
Specifically, on certain devices (e.g. Apple Watch Series 10, watchOS 26.2.1), the background delivery frequency is significantly reduced, behaving as if it is capped at approximately once per hour. On other control devices, under the same configuration, background delivery is triggered much more frequently and consistently, at approximately every 8–16 minutes.
This behavior is consistently reproducible on the affected devices.
**We would like to understand whether there are any officially recommended implementation patterns, best practices, or device-/system-level considerations when using HKObserverQuery and Background Delivery, in order to achieve more consistent and predictable background update behavior across different devices running the same system version. **
2/ Detailed Device Comparison
We conducted internal comparison testing across multiple devices with the following results:
Device A (Affected / Abnormal)
Model: Apple Watch Series 10 (46mm)
OS: watchOS 26.2.1
Serial (partial): C*HY
Background Delivery Frequency: ~ once every 60 minutes (significantly lower than expected)
Device B (Normal)
Model: Apple Watch Series 10 (42mm)
OS: watchOS 26.2.1
Serial (partial): G*4R
Background Delivery Frequency: ~ every 8–16 minutes
Device C (Normal)
Model: Apple Watch Series 8 (41mm)
OS: watchOS 26.3
Serial (partial): C*J6
Background Delivery Frequency: ~ every 8–16 minutes
Device D (Normal)
Model: Apple Watch Series 5 (41mm)
OS: watchOS 10.6.1
Serial (partial): G*TQ
Background Delivery Frequency: ~ every 8–16 minutes
All devices share the following conditions:
HealthKit permissions: Full read/write permissions granted
Background App Refresh: Enabled
System state: Low Power Mode, Do Not Disturb, and all Focus modes disabled
App build: Identical app build installed on all devices
HealthKit configuration: Same data types and same frequency parameter used in enableBackgroundDelivery
Implementation: Identical HKObserverQuery implementation logic
3/ Abnormal Behavior Observed
On the affected device(s), we observe that:
HealthKit background delivery appears to be heavily coalesced or throttled
The system rarely attempts to wake the App Extension
Behavior is clearly inconsistent with other devices using the same configuration
The behavior does not match our expectations for HealthKit Background Delivery with .immediate frequency
4/ Troubleshooting Already Performed
We have already attempted the following on the affected device(s):
Restarted both Apple Watch and paired iPhone
Re-paired the Apple Watch
Uninstalled and reinstalled the app
Revoked and re-granted HealthKit permissions
Confirmed that Low Power Mode, Do Not Disturb, and Focus modes are all disabled
The issue remains consistently reproducible.
5/ Assistance Requested
We would appreciate guidance on:
Whether there are any officially recommended implementation patterns, tuning options, or best practices for using HKObserverQuery and HealthKit Background Delivery
Whether there are any known device-level or system-level factors that may cause significantly different background delivery behavior on different devices running the same watchOS version
How to best achieve consistent and predictable background update delivery behavior across devices for apps that rely on this mechanism
6/ Additional Information
We can provide sysdiagnose logs from both affected and unaffected devices for comparison
We can also provide a minimal reproducible sample project if needed
How to legally and compliantly upload users' fitness and health data to our own server—while adhering to Apple's strict privacy policies—for analysis by our AI large model to provide personalized feedback and recommendations to users.
After upgrading to a new iPhone and restoring from an iCloud backup using the same Apple ID, I noticed an issue with Health app permissions.
■ What is happening
On my previous iPhone, an app had permission to read step count data.
After restoring to the new iPhone, the app still appears in the Health app under Sources.
However, when I tap the app, the usual data type permission toggles (such as Steps) are not displayed at all.
As a result, the app is unable to read step count data.
■ Additional details
The app itself seems to be recognized as a Health data source.
However, the data type permission screen is empty.
No ON/OFF switches are shown.
The backup was created on iOS 18, and the restore was performed on iOS 26.
I have not yet confirmed whether this also happens with other iOS version combinations.
■ Questions
Is it expected behavior that Health app permissions (per data type) are not restored via iCloud backup?
Has anyone experienced a similar situation where the app appears under Sources but the permission options are missing? If so, how did you resolve it?
Any information from users who have experienced the same issue would be greatly appreciated.
I cannot access my corporate invoice. I don't know why I couldn't reach it. How and where can I reach it?
Topic:
App & System Services
SubTopic:
Health & Fitness
Hi,
Need input on making ICEcard app paid version , requirements. The app is presently live for India and shortly will be for global. This app is for primary health information which is critical in case anyone faces emergency. Will it have any regulatory concerns ?
https://apps.apple.com/in/app/ice-card-app/id6736453602
Topic:
App & System Services
SubTopic:
Health & Fitness
I've searched all the App Intent and AssistantSchemas related documentation and I can't find anything related to workout, do I still need to use SiriKit?
Hello Apple Developer Community,
I’m working on creating a chart that combines Screen Time Usage data with Workout Time from HealthKit.
I’ve successfully implemented a DeviceActivityReportExtension to fetch Screen Time data and draw a chart. I’m also able to read HealthKit data from the main app.
However, I’m having trouble integrating the HealthKit data into the View generated by the DeviceActivityReportExtension. I’ve attempted to read HealthKit data directly from the extension , but this doesn’t seem to work, likely due to HealthKit access restrictions in extensions.
I also tied using a shared object to pass HealthKit data to the extension, but unfortunately this didn’t seem to work as expected.
I’d greatly appreciate any suggestions on how to successfully integrate HealthKit data into the extension-generated View. Has anyone dealt with a similar challenge or found a workaround for this?
Thanks in advance for your help!
For an app that plan to integrate Apple HealthKit to allow app users to upload and download their health data, where can I locate the Data Processing Addendum that specifies who the data controller and processor will be, and how such health data will be used or distributed?
I'm trying to run this example project: https://developer.apple.com/documentation/HealthKit/building-a-multidevice-workout-app
When I run it on my device (iPhone 16 Pro and Apple Watch Ultra 2)
I get this error:
-[SPRemoteInterface _appRecoverAnyExtendedRuntimeSession:]_block_invoke:4350: Got no sessions back from -[CSLSSessionService existingRunningSessions:] or -[CSLSSessionService existingScheduledSessions:] after receiving a PUICInitializeSessionServiceAction
I start the workout from my phone, which successfully starts the workout on the watch. But this callback is never triggered on the phone:
healthStore.workoutSessionMirroringStartHandler {
// not happening
}
This makes it difficult to learn the mirroring workout technique.
I'm using Xcode 16.3 and Mac OS 15.4.1.
Any help appreciated!