gpt4 book ai didi

ios - 如何找到 HKMetadataKeyMaximumSpeed

转载 作者:行者123 更新时间:2023-12-02 19:01:11 26 4
gpt4 key购买 nike

我想知道如何使用 HealthKit 查找用户的最高速度。

我遇到过这个HKMetadataKeyMaximumSpeed但不知道如何实现/使用它。这些文档对我来说不是很清楚。

有人可以在这里提供任何帮助吗?

最佳答案

苹果表示:

HKMetadataKeyMaximumSpeed Set this key on a workout, workout segment, or a quantity sample that represents distance. Set its value to an HKQuantity object with a length/time unit (for example, m/s)

因此您可以将此函数与此属性一起使用:

func workoutSession(_ workoutSession: HKWorkoutSession, didGenerate event: HKWorkoutEvent) {

if event.type == .segment {

let maxSpeed = event.metadata?[HKMetadataKeyMaximumSpeed]

// do it here your logic
}

关于您的评论:您无法在模拟器上生成这些事件。

关于ios - 如何找到 HKMetadataKeyMaximumSpeed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65553571/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com