0

Our app seems to have all the pieces in place to fill the fitness rings on Apple Watch:

  1. Workout session starts with activity type HKWorkoutActivityTypeWalking and creates streaming queries for HR, calories and distance.
  2. Samples are stored in arrays
  3. Workout session ends, and, after converting it to an HKWorkout object, is saved to HealthKit
  4. Samples are saved to the HKWorkout object in HealthKit successfully

The workout appears in the Fitness rings app with our app's icon, but in the bar graphs above the Move and Exercise bars don't attribute to our app. What could we be missing?

Thank you!!!

  • 1
    Tyler, try taking a look at the following link, which has documents some tricky details of getting this to work correctly: https://developer.apple.com/library/watchos/samplecode/ActivityRings/Introduction/Intro.html – Allan Nov 20 '15 at 22:16
  • Thanks Allan. Will do. – Tyler Martin Nov 20 '15 at 23:49
  • Allan: it appears we're already doing exactly what is instructed by this app. Very perplexing. You say "tricky details" but which part do you see as being tricky? – Tyler Martin Nov 21 '15 at 00:14
  • 1
    Are you saving new copies of the calorie samples and associating those with the workout, instead of the samples that came from the device? That's a key step to getting the samples to show up in Activity. – Allan Nov 21 '15 at 23:35
  • That did the trick. Thank you again Allan! Your timely answers are hugely appreciated! – Tyler Martin Nov 23 '15 at 00:36
  • 1
    Cool, I'm going to put the advice in an official answer to make it clear for other folks that have the same question! – Allan Nov 23 '15 at 00:53
  • Great, thanks again. BTW, how did you know that creating your own samples was the key? Also, how does HK know if a sample is distinct from the samples generated by the watch? – Tyler Martin Nov 24 '15 at 01:07

1 Answers1

1

Take a look at this sample code recently posted by Apple. One non-obvious but key step to getting your workouts to show up correctly in the user's Activity graphs is to save your app's own copy of the calorie samples that you want to associate with the workout.

Allan
  • 7,039
  • 1
  • 16
  • 26