简体   繁体   English

HealthKit-获取血糖餐时间

[英]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. 如何使用HealthKit Query获取用餐时间。 Any help is appreciated. 任何帮助表示赞赏。

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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