我用 AppleWatch 跟踪的一些锻炼确实包含有关海拔增益的信息。有些人还向我展示了锻炼的最大和最小高度。
我还有一个跟踪锻炼的应用程序,想知道如何添加这些信息。我正在经历,HKQuantityTypeIdentifier
但在那里找不到任何有用的东西。然后我看看HKWorkoutRouteBuilder
哪个有元数据字典,但在那里也找不到任何相关的键。
有人知道如何在 HealthKit 中为我的锻炼添加最大/最小高度和海拔增益等信息吗?
我用 AppleWatch 跟踪的一些锻炼确实包含有关海拔增益的信息。有些人还向我展示了锻炼的最大和最小高度。
我还有一个跟踪锻炼的应用程序,想知道如何添加这些信息。我正在经历,HKQuantityTypeIdentifier
但在那里找不到任何有用的东西。然后我看看HKWorkoutRouteBuilder
哪个有元数据字典,但在那里也找不到任何相关的键。
有人知道如何在 HealthKit 中为我的锻炼添加最大/最小高度和海拔增益等信息吗?
这些是唯一可以添加到 HealthKit 锻炼中的与海拔相关的元数据键:
海拔增益、最小值和最大值的数字可能指的是 Activity 应用程序中显示的信息,用于使用内置 Apple Watch Workouts 应用程序记录的锻炼(例如跑步、骑自行车、步行锻炼)。据我所知,无法使用可用的 Health API 从另一个应用程序添加该信息。
如果您比较 Activity 应用程序显示的内容和 Health 显示的相同锻炼内容,您可以看到 Activity 应用程序具有未显示在 HealthKit 元数据中的其他信息。
As @Paolo says you can't add the metadata but you may be able to provide altitude data in the route.
The route is made up of CLLocation
s and that can provide altitude data. I found in my app, that takes a Fitness app route from HealthKit, that I needed to calculate the min/max myself from the altitude data in each CLLocation
in the route.
So I assume that’s how the Fitness app does it. @mxswd informed me on twitter that just providing the altitude isn’t enough, but perhaps there are more properties that need to be set, like verticalAccuracy
?