health-kit

Missing HealthKit Entitlement

你离开我真会死。 提交于 2019-12-06 07:12:06
问题 I am trying to integrate HealthKit with an app I'm building, and I seem to have successfully added the entitlement for it. I've created and downloaded a provisioning profile with the appropriate app ID, and the HealthKit toggle in the Xcode Capabilities tab seems to look fine: However, when I run the app, I get the following error: HealthKit authorization denied! Error Domain=com.apple.healthkit Code=4 "Missing com.apple.developer.healthkit entitlement." UserInfo={NSLocalizedDescription

Try HealthKit with the iOS Simulator without developer account

℡╲_俬逩灬. 提交于 2019-12-06 04:20:54
I would like to test a HealthKit app in the iOS Simulator without an iPhone Developer Account. I added an entitlement file with the com.apple.developer.healthkit capability enabled and when I build the app it seems to include the file in the bundle but then when I try to access the HealthKit API the Simulator throws this error: Error Domain=com.apple.healthkit Code=4 "Missing com.apple.developer.healthkit entitlement." UserInfo=0x7fc939f091c0 {NSLocalizedDescription=Missing com.apple.developer.healthkit entitlement.} Is there any option to try HealthKit in the iOS Simulator without a Developer

HealthKit - requestAuthorization(toShare:read:completion:) always succeeds

China☆狼群 提交于 2019-12-06 02:49:43
问题 I'm using Xcode 8 beta 6 and I'm requesting access to the Health App. The method requestAuthorization(toShare:read:completion:) which asks for authorization always produces a true when the completion handler returns - success in my code below. Even when I decline everything in the simulator i get a true . Here is my code which handles the authorization. Is something in my code wrong or is this a Xcode bug? import Foundation import HealthKit class HealthManager { private let healthStore =

For iOS healthkit how to save systolic and diastolic blood pressure values?

两盒软妹~` 提交于 2019-12-05 15:57:07
Here is code for saving blood pressure data in health kit HKUnit *BPunit = [HKUnit millimeterOfMercuryUnit]; HKQuantity *BPSysQuantity = [HKQuantity quantityWithUnit:BPunit doubleValue:150.0]; HKQuantityType *BPSysType = [HKQuantityType quantityTypeForIdentifier:HKQuantityTypeIdentifierBloodPressureSystolic]; HKQuantitySample *BPSysSample = [HKQuantitySample quantitySampleWithType:BPSysType quantity:BpsysQuantity startDate:now endDate:now]; [self.healthStore saveObject:BPSysSample withCompletion:^(BOOL success, NSError *error) same way for diastolic also, But how to save both combine as single

Open Apple Health programmatically

徘徊边缘 提交于 2019-12-05 04:10:18
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 cannot request permissions again - just like with other things like Camera access, etc. However, if the user refuses Camera permissions, I can direct them to the Settings page directly where they can change those permissions. NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString]; [[UIApplication sharedApplication] openURL:url]; Is

Calories not being recorded for HealthKit Watch app

别来无恙 提交于 2019-12-05 01:01:00
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 setTotalCalories(calories: Double) { totalEnergyBurned = HKQuantity(unit: HKUnit.kilocalorie(), doubleValue: calories) } func startQuery(quantityTypeIdentifier: HKQuantityTypeIdentifier) { let datePredicate = HKQuery.predicateForSamples(withStart: workoutStartDate, end: nil, options: .strictStartDate) let devicePredicate = HKQuery.predicateForObjects(from:

Monitor heart rate from HealthKit --> HKAnchoredObjectQuery only called after applicationDidBecomeActive (BUG or FEATURE?)

折月煮酒 提交于 2019-12-04 23:46:48
问题 I am writing a simple app to monitor the heart rate (HKQuantityTypeIdentifierHeartRate) from HealthKit whenever a new health rate value is written to HealthKit. As seen at WWDC2015 (session 203) I am using a HKAnchoredObjectQuery which should work for adding and deleting objects. Whenever I start the app I am calling the HKQuery for the newest objects and executingQuery which works fine!!! But I am getting no new samples even if the samples are there, but if I bring the app to the background

Displaying Menstruation Details in Health Kit App in iOS

故事扮演 提交于 2019-12-04 20:37:40
I have a health kit object with all the proper setup; however, I am trying to retrieve the menstruation data of health kit. However, I cannot be able to find out the corresponding type in HKQuantityTypeIdentifier (i.e. HKCategoryValueMenstrualFlow ). The HKCategoryValueMenstrualFlow is having some of the sub items such as HKCategoryValueMenstrualFlowLight , HKCategoryValueMenstrualFlowMedium , HKCategoryValueMenstrualFlowHeavy . Using the following method, I am writing my code like this: -(void)viewDidLoad { HKHealthStore *healthStore = [[HKHealthStore alloc] init]; HKCategoryType *q=[NSSet

How to get sensor data from Apple Watch to iPhone?

情到浓时终转凉″ 提交于 2019-12-04 19:51:21
问题 Is there a way to get sensor data from Apple Watch? For example, how can I connect and get heart rate from Apple Watch to my app? These are the steps I need do in my app: Define a delegate to receive heart rate information from Apple Watch. Make a request to Apple Watch to send the data periodically I know how it works for other HR monitors over BT. Is the interface similar to that? Or should depend on HealthKit to achieve that? 回答1: As per WatchKit FAQ on raywenderlich.com (scroll to "Can

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

别来无恙 提交于 2019-12-04 18:13:45
问题 How to use : HKUnit Sample type Unit type Unit name Unit string Heart Rate count/time Beats per Minute "count/min” 回答1: Swift : Heart Rate (bpm) save into healthkit store private func saveHeartRateIntoHealthStore(height:Double) -> Void { // Save the user's heart rate into HealthKit. let heartRateUnit: HKUnit = HKUnit.countUnit().unitDividedByUnit(HKUnit.minuteUnit()) let heartRateQuantity: HKQuantity = HKQuantity(unit: heartRateUnit, doubleValue: height) var heartRate : HKQuantityType =