Tag: 健康监视

如何阅读healthKit心率数据?

我知道这个问题已经被问到,但还没有真正的答案。 我已经尝试了这样的线程: 心率与苹果公司的Healthkit 我试图从Objective-C转换到Swift,但没有工作。 我的问题是,什么是阅读健康包的心率数据的最佳方式。 我希望能够读取每次心率测量的时间,我希望能够看到所述测量的时间/date戳。 我在这里要求许可: import Foundation import UIKit import HealthKit class HealthKitManager: NSObject { static let healthKitStore = HKHealthStore() static func authorizeHealthKit() { let healthKitTypes: Set = [ HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierHeartRate)!, ] healthKitStore.requestAuthorizationToShareTypes(healthKitTypes, readTypes: healthKitTypes) { _, _ in } } } 这里是我现在的视图控制器代码(我不知道为什么这不起作用): import UIKit import HealthKit class ViewController: UIViewController { let health: HKHealthStore […]