apple-watchwatchoshkworkoutsession

With HealthKit, is calling end() required when done with workout?


For a watchOS app, do you have to call end() on a HKWorkoutSession even if your app doesn't care about the transition to the ended state? Apple's Running workout sessions article includes it in the call sequence, but is it strictly required, or is releasing all references to the workout session sufficient?


Solution

  • Calling end() is required. Until you call end(), the Smart Stack continues to show that a workout session is running, even if you app has no reference to the HKWorkoutSession.