【问题标题】:HealthKit - accumulate energy burned in watchOS 4HealthKit - 累积在 watchOS 4 中消耗的能量
【发布时间】:2017-09-04 09:59:10
【问题描述】:

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

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

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

那么,要测量现在燃烧的能量,我们是累积smallCalorie()largeCalorie() 还是两者兼而有之?

不幸的是,今天的 Apple 文档仍处于测试阶段,并没有告诉我们太多信息。

【问题讨论】:

    标签: swift watchkit healthkit watchos-4


    【解决方案1】:

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

    largeCalorie = smallCalorie * 1000

    【讨论】:

      猜你喜欢
      • 2015-08-31
      • 1970-01-01
      • 1970-01-01
      • 2019-02-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-24
      • 1970-01-01
      相关资源
      最近更新 更多