简体   繁体   English

如何从 HealthKit 获取历史 Step 数据

[英]How to get historic Step data from HealthKit

I want to fetch historic pedometer data from HealthKit.我想从 HealthKit 获取历史计步器数据。 But documentation states that only the last seven days are available.但文件指出,只有最后 7 天可用。

The thing is: other apps exist, that plot years of data of mine.问题是:存在其他应用程序,即 plot 年我的数据。

Does anyone have suggestion on how to access older data?有人对如何访问旧数据有建议吗?

I think you were reading CoreMotion documentation.我认为您正在阅读 CoreMotion 文档。 There it says, that the data from Pedometer is saved on the device for the last 7 days.那里说,计步器的数据在过去 7 天内保存在设备上。 https://developer.apple.com/documentation/coremotion/cmpedometer/1613946-querypedometerdatafromdate?language=objc https://developer.apple.com/documentation/coremotion/cmpedometer/1613946-querypedometerdatafromdate?language=objc

For HealthKit there is no such a limit. HealthKit 没有这样的限制。 You can fetch the data from Health App for a couple of years if you have it.如果你有的话,你可以从 Health App 中获取几年的数据。 You just specify the time interval you are interested and query the data using, for example, HKSampleQuery.您只需指定您感兴趣的时间间隔并使用例如 HKSampleQuery 查询数据。 Please refer to https://developer.apple.com/documentation/healthkit/hksamplequery请参考https://developer.apple.com/documentation/healthkit/hksamplequery

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM