Questions tagged [healthkit]

HealthKit is a framework for iOS and watchOS that allows health and fitness services to share their data with the new Health app and with each other.

HealthKit allows apps that provide health and fitness services to share their data with the new Health app and with each other. A user’s health information is stored in a centralized and secure location and the user decides which data should be shared with your app.

HealthKit also works directly with health and fitness devices. In iOS 8.0, the system can automatically save data from compatible Bluetooth LE heart rate monitors directly into the HealthKit store. The system can also automatically import step count data from the M7 motion coprocessor, if available. Other devices and data sources must have a companion app that can access the data and save it to HealthKit for them.

Quick Reference:

1188 questions
14
votes
1 answer

Calories not being recorded for HealthKit Watch app

I can't get any calories/activeEnergyBurned to show up in my app, and don't know why? WorkoutInterfaceController: private func totalCalories() -> Double { return totalEnergyBurned.doubleValue(for: HKUnit.kilocalorie()) } private func…
SRMR
  • 3,064
  • 6
  • 31
  • 59
14
votes
4 answers

Query HealthKit data via REST API

Is it possible to get data from Healthkit the same way as you would query regular API (With user's consent) to store in my webapp? Something like: healthkit.com/api/v1/user/GetWeight If yes, where can I find a list of available methods? If not, are…
user194076
  • 8,787
  • 23
  • 94
  • 154
14
votes
2 answers

HealthKit Authorisation Status is always 1

I am using HealthKit in my app. I am getting the Permission from the user for accessing the HealthKit Data. After the Authorisation, if I check for authorised status for a particular HealthKit Object type, it always returns that the access is…
iranjith4
  • 378
  • 2
  • 13
14
votes
3 answers

iOS HealthKit how to save Heart Rate (bpm) values? Swift

How to use : HKUnit Sample type Unit type Unit name Unit string Heart Rate count/time Beats per Minute "count/min”
Vinod Joshi
  • 7,696
  • 1
  • 50
  • 51
13
votes
3 answers

Open Apple Health programmatically

Is it possible to open the Health app programmatically, like one can do with the Settings app? If it's not possible to open the app's Apple Health permissions screen directly, can we at least open the main Apple Health screen? Edit: I know that I…
SaltyNuts
  • 5,068
  • 8
  • 48
  • 80
13
votes
1 answer

REST API for Apple Health Data

Is there any REST API support for health data by Apple? I know healthkit api helps to send and receive data from apple health data store but it is very much restricted to ios apps. What i am trying to achieve is to utilize the send/receive from any…
12
votes
2 answers

How to get Apple health data by date wise?

Apple health app gives the data by Date wise as shown in below image. By using HealthKit i am fetching the steps data from apple health as let p1 = HKQuery.predicateForSamples(withStart: fromDate, end: Date(), options: .strictStartDate) let p2 =…
Jack
  • 13,571
  • 6
  • 76
  • 98
12
votes
2 answers

HealthKit Permission Sheet Not Appearing

In my watch extension I call this function: func requestAuthorization() { let healthStore = HKHealthStore() let workoutType = HKObjectType.workoutType() let heartRateType = HKObjectType.quantityType(forIdentifier:…
raginggoat
  • 3,570
  • 10
  • 48
  • 108
12
votes
1 answer

HKWorkoutSession not resuming custom workout app if screen gets locked or active app changed

I have a watchOS 2 app that displays health data during a run. I start a workout using HKWorkoutSession as follows: self.workoutSession = HKWorkoutSession(activityType: .Running, locationType: .Outdoor) self.workoutSession!.delegate =…
lehn0058
  • 19,977
  • 15
  • 69
  • 109
12
votes
1 answer

Apple Healthkit and iOS 7 deployment target

When trying to submit an app through Xcode or Application loader, with the "healthkit" entitlement enabled and a deployment target of 7.0, the app store gives the following error: ERROR ITMS-9000: This bundle is invalid. The key…
Andy M
  • 309
  • 2
  • 9
12
votes
8 answers

HealthKit error: Missing com.apple.developer.healthkit entitlement

I'm adding code for HealthKit in my iOS Swift app, but I'm getting an error: /* Ask for permission to access the health store */ override func viewDidAppear(animated: Bool) { super.viewDidAppear(animated) if…
user3739367
  • 4,161
  • 6
  • 20
  • 18
11
votes
1 answer

Open Health and go to an App's permission via URL Scheme

Can we link directly to Sources then my app? I tried to open an URL like x-apple-health://sources/MyApp but it only open Sources and not goes directly to MyApp. Anyone knows if that's even possible? EDIT: this is not a duplication of Open HealthKit…
Adam Ivancza
  • 2,459
  • 1
  • 25
  • 36
11
votes
1 answer

How to `addQuantitiesFromSamples` in HealthKit?

Building a HealthKit/WatchKit app based off WWDC 2015 - Session 203. There is no source code so I am writing it on the fly. There is a method I am having difficulty with since they don't discuss it. Luckily it's the same addQuantitiesFromSamples…
Edison
  • 11,881
  • 5
  • 42
  • 50
11
votes
3 answers

How to launch system apps in an iOS Xcode UI test case

I've got an app whose main purpose is to enter data into HealthKit. I'd like to write some Xcode UI tests to verify that it's writing this data successfully, but I'm having some difficulty verifying the data in the Health app. When I initially…
Dov
  • 15,530
  • 13
  • 76
  • 177
11
votes
1 answer

HealthKit data inaccessible in background

I want to pull HealthStore data in the background using background fetch but I keep getting an error: Error Domain=com.apple.healthkit Code=6 "Protected health data is inaccessible" UserInfo=0x17026fdc0 {NSLocalizedDescription=Protected health data…
efremidze
  • 2,640
  • 1
  • 25
  • 35
1
2
3
79 80