检测是否已手动输入HealthKit活动 [英] Detect if HealthKit activity has been entered manually

查看:103
本文介绍了检测是否已手动输入HealthKit活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您可以通过来源活动查看哪个应用插入了活动。有没有办法知道活动是否已手动输入,或活动是否是从传感器实时录制并添加到HealthKit的活动?

You can check which app inserted the activity via the 'source' activity. Is there a way to know if the activity has been entered manually or if the activity was an activity that was recorded live from sensors and added to HealthKit?

推荐答案

Apple仅为 HKSource 类提供两个属性, bundleIdentifier 源的名称,从iOS8.x开始

Apple only provides two properties for the HKSource class, the bundleIdentifier and the name of the source, as of iOS8.x

如果手动输入,则条目的包标识符将为 com。 apple.Health ,这是Health应用程序的包标识符。注意资本 H 。当您提取数据时,只需忽略具有com.apple.Health包标识符的数据。

The bundle identifier of the entry if made manually will be com.apple.Health, which is the bundle identifier of the Health app. Notice the capital H. When you pull your data just ignore the data which has a bundle identifier of com.apple.Health.

这样您将只考虑非手动的活动。

That way you will be only considering activities which are not manual.

希望这会有所帮助。如果您需要更多信息,请告诉我。

Hope this helps. Let me know if you need more information.

您还可以参考此处的链接以获取其他方式:忽略Apple Health应用程序中的手动条目作为数据源

You can also refer the link here for another way to do this: Ignore manual entries from Apple Health app as Data Source

这篇关于检测是否已手动输入HealthKit活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆