简体   繁体   中英

HealthKit - Get Blood Glucose Meal Time

When adding a new blood glucose reading, it's possible to choose Meal Time for the reading. There's picker with three values (Unspecified, Before Meal, After Meal).

I was able to successfully get the reading using

HKQuantitySample sample = ...
var value = sample.quantity.GetDoubleValue(hkUnit);

But I've no idea how to get the mealtime.

How can I get the meal time using HealthKit Query. Any help is appreciated.

可以通过metadata属性获取它):

let mealtime = sample.metadata?[HKMetadataKeyBloodGlucoseMealTime] as? Int

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM