healthkit

Healthkit HKAnchoredObjectQuery in iOS 9 not returning HKDeletedObject

僤鯓⒐⒋嵵緔 提交于 2019-12-23 04:43:47
问题 I was excited to learn that Apple added tracking of deletes in HealthKit in iOS 9. So I set up a test project to try it out. Unfortunately, while I can get new data just fine, I am not getting any deleted objects in my callbacks. I have a functioning HKAnchoredObjectQuery that tracks HKQueryAnchor and gives me new HKSamples whenever I add a BloodGlucose quantity into HealthKit via the Health app. However when I delete that same quantity and re-run the app the HKDeletedObject is always empty.

Populating the mindfulness section in the iOS Health Section

别说谁变了你拦得住时间么 提交于 2019-12-23 04:28:42
问题 I found the Health app has a mindfulness section, yet I did not find in the documentation how to contribute to that section. Concocting a web search for this requirement returns me a collection of worldwide retreat centers... could you direct me to something meaningful? 回答1: I found HKCategoryTypeIdentifierMindfulSession . A category sample type for recording a mindful session. Apple docs. This is iOS 10+ only. I think they created this for the new Breathe app to track how much time you spent

Terminating app due to uncaught exception '_HKObjectValidationFailureException'

微笑、不失礼 提交于 2019-12-21 19:58:47
问题 I am saving the blood glucose values into Health Kit application in iOS. -(void)viewDidLoad { float bloodGlucose=20; float bloodGlucoseValue= (int) bloodGlucose; NSLog(@"Blood Glucose value is :%f",bloodGlucoseValue); HKQuantityType *bloodGlucoseType=[HKQuantityType quantityTypeForIdentifier:HKQuantityTypeIdentifierBloodGlucose]; NSSet *requesObjects=[[NSSet alloc]initWithObjects:bloodGlucoseType, nil]; HKHealthStore * hStore = [HKHealthStore new]; [hStore requestAuthorizationToShareTypes:

Detect if HealthKit activity has been entered manually

谁说我不能喝 提交于 2019-12-21 17:44:45
问题 You can check which app inserted the activity via the 'source' activity. Is there a way to know if the activity has been entered manually or if the activity was an activity that was recorded live from sensors and added to HealthKit? 回答1: Apple only provides two properties for the HKSource class, the bundleIdentifier and the name of the source, as of iOS8.x The bundle identifier of the entry if made manually will be com.apple.Health , which is the bundle identifier of the Health app. Notice

Get most recent data point from HKSampleQuery

大憨熊 提交于 2019-12-20 05:23:23
问题 I am having trouble getting the latest datapoint for weight using an HKSampleQuery . I have the app permissions set correctly, but HKQuantityTypeIdentifier.bodyMass is not returning the most recent data entry from the Health app. How am I supposed to grab the latest datapoint for body mass using an HKSampleQuery ? The reason I think this is because the 0.0 I set for Weight is what is returning and I am getting no console output on readWeight Edit 1 My code including the debugging process is

Get and Set info in Medical ID using Healthkit?

北城余情 提交于 2019-12-20 04:25:22
问题 I am trying to get the information from Medical ID for example Conditions, Medical notes, Allergies & reactions, all that kind of info. I'm using Swift and Health Kit. For the moment the only info that I can get is dateOfBirth, biologicalSex, and bloodType. import UIKit import HealthKit class ViewController: UIViewController { let healthKitStore: HKHealthStore = HKHealthStore() override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from

Xamarin.ios build rejected due to HEALTHKIT reference

妖精的绣舞 提交于 2019-12-18 09:04:24
问题 My xamarin.ios build has been rejected from the app center due to reference of HEALTHKIT framework. I can't set linker to SDK framework only because of some 3rd party liberary. Also, I have uploaded a nee build with mtouch parameter "--linkskip=HealthKit", still my app got rejected 2nd time. Can anyone please guide me what more cahnges need to be done to remove the reference of HEALTHKIT framework from the application. Amy suggestion will be helpful 回答1: I had this recently, also tried what I

Call external function using WatchKit force touch MenuItem

拈花ヽ惹草 提交于 2019-12-18 08:25:39
问题 I need to implement a WatchKit force-touch MenuItem to call a saveWorkout() method that is located in a separate class that does not subclass WKInterfaceController . I realize that every class needs at least one designated initializer. I am guessing this is the key? Btw, my " saveSession() reached " print statement logs to the console when using the sim but not when I use a device. All other print statements log to the console even when using the device. A bit odd. My attempts at

Call external function using WatchKit force touch MenuItem

孤者浪人 提交于 2019-12-18 08:25:09
问题 I need to implement a WatchKit force-touch MenuItem to call a saveWorkout() method that is located in a separate class that does not subclass WKInterfaceController . I realize that every class needs at least one designated initializer. I am guessing this is the key? Btw, my " saveSession() reached " print statement logs to the console when using the sim but not when I use a device. All other print statements log to the console even when using the device. A bit odd. My attempts at

HKWorkoutSession: Not getting Heart Rate when screen is turned off in watchOS 2

会有一股神秘感。 提交于 2019-12-18 04:23:25
问题 I am using iOS 9 beta 4 and watchOS 2 beta 4. I can't seem to get any heart rate data when the watch screen turns black (locks). I will get a call to applicationWillResignActive and then the heart rate data just stops. It seems that the sensor is deactivating after some time as well (not green anymore), when the screen locks. Anyone else seeing this behavior? I can post my code for initing the WorkoutSession if anyone else getting heart rate data when the screen on the watch is locked. 回答1: