iosobjective-chealthkit

How to get the name of HKWorkoutActivityType in HealthKit?


Ok, so the property workoutActivityType of the HKWorkout returns a NSInteger.

Here is a list with the activities: workoutActivityType list

For now, I will create a plist and look for the activity name when I get the integer. But it seems a little odd to have to go through this.

Do I need to find out which activity it is on my own or is there something I am missing?


Solution

  • Unfortunately, apple only provides an enum and you would have to implement your own names. A good idea is to lazily instantiate a dictionary including keys of NSNumber (Object wrapped NSInteger) and values of strings. Should be quite easy to make and unfortunately the only solution.