cyclingSpeed is 0

Hi, I am running the "Building a multidevice workout app" sample: https://developer.apple.com/documentation/healthkit/workouts_and_activity_rings/building_a_multidevice_workout_app

I do not get any values for the .cyclingSpeed Value? Is this correct or should there be any value while moving around?

Also i wonder if i can get the GPS values like altimeter or location from the HKWorkoutSession?

Thanks

Accepted Reply

Also i wonder if i can get the GPS values like altimeter or location from the HKWorkoutSession?

To gather these data you need CLLocation manager running along workout. When HKWorkoutSession is finished you create HKWorkout from it. And you could also create HKRoute from gathered locations (including altitudes) and associate it with HKWorkout https://developer.apple.com/documentation/healthkit/workouts_and_activity_rings/creating_a_workout_route

Replies

Also i wonder if i can get the GPS values like altimeter or location from the HKWorkoutSession?

To gather these data you need CLLocation manager running along workout. When HKWorkoutSession is finished you create HKWorkout from it. And you could also create HKRoute from gathered locations (including altitudes) and associate it with HKWorkout https://developer.apple.com/documentation/healthkit/workouts_and_activity_rings/creating_a_workout_route