且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

HKSampleQuery将仅返回过去7天的值吗?

更新时间:2023-02-16 21:31:44

HealthKit仅提供对最后一周数据的访问.您可以使用HKHealthStore方法 earliestPermittedSampleDate 进行查询日期.如果您需要从HealthKit查询可能已经使用了一周以上的历史样本,则应使用配套的iOS应用程序进行查询,然后使用WatchConnectivity将相关信息发送到watchOS应用程序.

HealthKit on watchOS only provides access to the last week of data. You can use the HKHealthStore method earliestPermittedSampleDate to query for the exact date. If you need to query for historical samples from HealthKit that may be more than a week old, you should do so with your companion iOS app and then send the relevant information to your watchOS app using WatchConnectivity.