返回 Skill 列表
extension
分类: 开发与工程无需 API Key

"healthkit"

HealthKit:HKHealthStore、授权、读取/写入健康数据、查询。在实现与HealthKit相关的应用程序功能时使用。

person作者: jakexiaohubgithub

Healthkit

HEALTHKIT:

  • import HealthKit; HKHealthStore()
  • Check availability: HKHealthStore.isHealthDataAvailable()
  • Request auth: healthStore.requestAuthorization(toShare:read:)
  • Requires NSHealthShareUsageDescription + NSHealthUpdateUsageDescription (add CONFIG_CHANGES)
  • Requires com.apple.developer.healthkit entitlement (add CONFIG_CHANGES)
  • Query: HKSampleQuery, HKStatisticsQuery for aggregated data
  • Common types: HKQuantityType(.stepCount), .heartRate, .activeEnergyBurned