HealthKit - 积累在watchOS 4中燃烧的能量

时间:2017-09-04 09:59:11

标签: swift watchkit health-kit watch-os-4

在watchOS 3中,当你想累积能量时,你可以使用类似的东西:

totalEnergyBurned.addQuantities(from: samples, unit: HKUnit.calorie())

现在在WatchOS 4中,HKUnit.calorie()已被弃用,已被HKUnit.smallCalorie()HKUnit.largeCalorie()取代。

那么,为了衡量现在消耗的能量,我们是否积累了smallCalorie()largeCalorie()或两者?

不幸的是,今天的Apple文档仍然在BETA中,并没有告诉我们多少。

1 个答案:

答案 0 :(得分:2)

根据Apple's documentationHKUnit.calorie()代表克卡路里。你应该使用smallCalorie(a.k.a. gram卡路里)来达到同样的目的。

largeCalorie = smallCalorie * 1000