HKWorkoutSession with HKAnchoredObjectQuery has very infrequent updates

I've been working this week on a test app to kick the tires of HKWorkoutSession and have been following the pattern exhibited in the What's New in HealthKit talk.


I'm to the point where I've got something working to track a workout, but I'm finding that the updateHandler for my HKAnchoredObjectQuery is firing very infrequently. Walking and Running distance updates periodically, but heart rate values update very rarely if at all. I know something is happening, because I see the green LEDs on the watch measuring my heart rate and the values propagate into HealthKit. There just aren't very many of them.


Is this the designed behavior, or can we expect to see more samples for HKWorkoutSession generated in a later watchOS 2 seed?


Has anyone else seen this work yet with retrieving more granular data?

Replies

would you mind sharing some of your code? I've been having a hard time even getting the point where I am running a workoutsession.

I am having the same issue. My app is tracking calories as well and they are been updated frequently but that doesn't happen with heart rate samples. In most of the cases no heart rate samples are generated.

Not sure if this is related to your issue or not, but in the release notes for beta 1, I noticed this under the HealthKit known issues section:


During an active workout session, new heart rate samples are not generated when the screen is off.


Figured I would share incase you or someone else reading this thread finds it useful.

The same issue here, I can see the green LED, but the updateHandler always not called.

When running on simulator, it's OK, the updateHandler called frequently.