AWARE: HealthKit
示例
要运行示例项目,请先克隆仓库,然后从 Example 目录运行 pod install
需求
安装
com.aware.ios.sensor.healthkit 可通过 CocoaPods 获得。
- 要安装它,只需将以下行添加到 Podfile 即可
pod 'com.awareframework.ios.sensor.healthkit'
- 将com_aware_ios_sensor_healthkit库添加到您的源代码中。
import com_awareframework_ios_sensor_healthkit
-
在 Xcode 中打开 HealthKit 功能
-
将
NSHealthShareUsageDescription
添加到 Info.plist 中
示例用法
let sensor = HealthKitSensor.init(HealthKitSensor.Config().apply{config in
config.debug = true
config.sensorObserver = Observer()
config.isHeartRateFetch = true
})
sensor.start()
class Observer:HealthKitObserver {
func onHealthKitAuthorizationStatusChanged(success: Bool, error: Error?) {
// Your code here..
}
func onHeartRateDataChanged(data: [HealthKitHeartRateData]) {
// Your code here..
}
}
作者
Yuuki Nishiyama, [email protected]
许可证
版权所有(c)2021 AWARE移动上下文仪器中间件/框架 (http://www.awareframework.com)
遵循Apache许可证第2版(“许可证”);除非遵守许可证或书面许可,否则您不得使用此文件。您可以在以下位置获得许可证副本:
https://apache.ac.cn/licenses/LICENSE-2.0除非根据适用的法律要求或书面同意,否则在许可证下分发的软件按“原样”基础分发,不提供任何明示或暗示的保证或条件。有关许可证限制的特定语言,请参阅许可证。