healthkit

Apple Watch Exercise Minute ring being updated from workout start-end time not from the Duration

ぃ、小莉子 提交于 2021-01-07 01:26:45
问题 We have a Fitness app and we are writing fitness data to the Healthkit like Steps, Walking Running distance, and Active energy. and it is working as expected in the Health App We also writing Workout data for Apple watch activity ring, we can show our data is reflected on the Apple Watch activity ring for Active Energy but Exercise Minutes ring being updated from workout start-end time not from the Duration The problem here is the Exercise ring vs Actual exercise done. Our app is sending the

Apple Watch Exercise Minute ring being updated from workout start-end time not from the Duration

自闭症网瘾萝莉.ら 提交于 2021-01-07 01:22:49
问题 We have a Fitness app and we are writing fitness data to the Healthkit like Steps, Walking Running distance, and Active energy. and it is working as expected in the Health App We also writing Workout data for Apple watch activity ring, we can show our data is reflected on the Apple Watch activity ring for Active Energy but Exercise Minutes ring being updated from workout start-end time not from the Duration The problem here is the Exercise ring vs Actual exercise done. Our app is sending the

Calculate Asleep time in HealthKit using Swift

流过昼夜 提交于 2020-11-29 19:15:30
问题 I have the following code that gets the sum of sleep hours. However, it is summing inbed and asleep together. What I am trying to get is a sum for just the asleep time. func readSleepAnalysis(date: Date) { if let sleepType = HKObjectType.categoryType(forIdentifier: HKCategoryTypeIdentifier.sleepAnalysis) { let startDate = convertSleepStartDate(StartDate: date) let endDate = convertSleepEndDate(EndDate: date) let predicate = HKQuery.predicateForSamples(withStart: startDate, end: endDate,

Get Apple watch heartRateVariabilitySDNN realtime?

為{幸葍}努か 提交于 2020-06-16 02:40:05
问题 I am using below function to get heartRateVariabilitySDNN, but its get only once and not calculate realtime like hearbeat does? func HRVstart() { guard let quantityType = HKObjectType.quantityType(forIdentifier: .heartRateVariabilitySDNN) else { return } self.healthStore.execute(self.HRVStreamingQuery()) // Create query to receive continiuous heart rate samples. let datePredicate = HKQuery.predicateForSamples(withStart: Date(), end: nil, options: .strictStartDate) let devicePredicate =

HealthKit开发教程之HealthKit的辅助数据

二次信任 提交于 2020-03-02 07:06:37
HealthKit开发教程之HealthKit的辅助数据 在 HealthKit 中除了主要数据之外,还有 6 个辅助数据分别为:体积类型数据、压力类型数据、时间类型数据、温度类型数据、标量类型数据和电导率类型数据。本节将针对这 6 个辅助数据进行讲解。 HealthKit的 体积类型数据 体积,或称容量、容积,几何学专业术语,是物件占有多少空间的量。体积单位可以用来测量物体的体积。由体积单位和值组成的数据就是体积类型的数据。体积单位可以分为:国际体积单位、英制体积单位和美制体积单位。 1. 国际体积单位 体积的国际单位为“升”,符号为 L 。如果想要创建一个以“升”为单位的单位对象,需要使用到 literUnit() 方法,其语法形式如下: class func literUnit() -> Self! 【示例 2-30 : HKUnit-literUnit 】下面显示一桶可乐的容量,以“升”为单位。代码如下: import UIKit import HealthKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from

HealthKit开发教程之HealthKit的主要类型数据

隐身守侯 提交于 2020-03-02 06:41:01
HealthKit开发快速入门教程之HealthKit的主要类型数据 在 HealthKit 中,我们将最常用到的数据称之为主要数据。主要数据基本上有三种:长度类型的数据、质量类型的数据、能量类型的数据。本节将主要对这三种主要数据进行讲解。 长度类型数据 长度单位是指丈量空间距离上的基本单元,是人类为了规范长度而制定的基本单位。而长度单位和数值构成的就是长度类型数据。根据单位的类型不同,该类型可以分为国际长度单位和英制长度单位两种。以下就是对这两种长度单位的介绍。 1. 国际长度单位 国际长度单位是“米”为单位的。对于此单位的创建,需要使用到 meterUnit() 方法,其语法形式如下: class func meterUnit() -> Self! 【示例 2-8 : HKUnit-meterUnit 】下面显示用户一天内的行走路程。代码如下: import UIKit import HealthKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. let unit = HKUnit