Post

Replies

Boosts

Views

Activity

Saving workout routes on the phone when locked
I'm using HKLiveWorkoutDataSource and HKWorkoutRouteBuilder. The running workouts my app supports can be timed or distance-based, so the user may complete the workout while the phone is locked. In this case, the workout route cannot be saved because HealthKit is locked. To work around this issue, I save route data to the device and listen for UIApplication.protectedDataDidBecomeAvailableNotification to later add the route to the workout. Note, this is not needed on the watch, just the phone. Is this limitation by design, or is there a better way to handle it? BTW, thanks for making these APIs available on the phone in iOS 26 and also adding the heart rate zone APIs in 27
3
0
100
2d
Editing Apple Health Workouts
Sometimes my users would like to update an Apple Health workout after it's been saved. For example, maybe they forgot to end the workout and want to trim it. Or maybe it was a treadmill workout, and they want to add the stats from the treadmill. The way I've attempted to do this in the past is to create a new HKWorkoutBuilder, call beginCollection, and add the data the user wants to keep from the original workout (events, activities, samples, workout route, and metadata with an incremented HKMetadataKeySyncIdentifier. After all that, I call endCollection() and finishWorkout() on the builder. Is this the right way to go about it? For trimming a workout, it would be great to have a way to just duplicate a workout with an adjusted start and end time and have HealthKit do all the hard work of trimming data.
2
0
60
2d
Checking Apple Health permissions
Is it safe to call HKHealthStore authorizationStatus() and getRequestStatusForAuthorization() on the main thread? It seems that these methods occasionally block. Any best practices for guiding a user to grant all required Apple Health permissions for a workout app? Because of privacy concerns, its difficult to know what permissions a user has granted or denied in order to guide them appropriately.
2
1
106
2d
Workout Activities for Interval Training Apps
Workout Activities are very useful for tracking metrics for each interval of a HIIT workout (e.g. Run/Walk or Work/Recover intervals for core body workout). However, if the workout contains lots of intervals (50 or more), I find that saving all those workout activities slow down saving the workout to Apple Health. Is this an appropriate use of workout activities? If so, it would be great to be able to set the activity type for each activity (e.g. run or walk).
1
0
47
2d
Saving workout routes on the phone when locked
I'm using HKLiveWorkoutDataSource and HKWorkoutRouteBuilder. The running workouts my app supports can be timed or distance-based, so the user may complete the workout while the phone is locked. In this case, the workout route cannot be saved because HealthKit is locked. To work around this issue, I save route data to the device and listen for UIApplication.protectedDataDidBecomeAvailableNotification to later add the route to the workout. Note, this is not needed on the watch, just the phone. Is this limitation by design, or is there a better way to handle it? BTW, thanks for making these APIs available on the phone in iOS 26 and also adding the heart rate zone APIs in 27
Replies
3
Boosts
0
Views
100
Activity
2d
Editing Apple Health Workouts
Sometimes my users would like to update an Apple Health workout after it's been saved. For example, maybe they forgot to end the workout and want to trim it. Or maybe it was a treadmill workout, and they want to add the stats from the treadmill. The way I've attempted to do this in the past is to create a new HKWorkoutBuilder, call beginCollection, and add the data the user wants to keep from the original workout (events, activities, samples, workout route, and metadata with an incremented HKMetadataKeySyncIdentifier. After all that, I call endCollection() and finishWorkout() on the builder. Is this the right way to go about it? For trimming a workout, it would be great to have a way to just duplicate a workout with an adjusted start and end time and have HealthKit do all the hard work of trimming data.
Replies
2
Boosts
0
Views
60
Activity
2d
Checking Apple Health permissions
Is it safe to call HKHealthStore authorizationStatus() and getRequestStatusForAuthorization() on the main thread? It seems that these methods occasionally block. Any best practices for guiding a user to grant all required Apple Health permissions for a workout app? Because of privacy concerns, its difficult to know what permissions a user has granted or denied in order to guide them appropriately.
Replies
2
Boosts
1
Views
106
Activity
2d
Workout Activities for Interval Training Apps
Workout Activities are very useful for tracking metrics for each interval of a HIIT workout (e.g. Run/Walk or Work/Recover intervals for core body workout). However, if the workout contains lots of intervals (50 or more), I find that saving all those workout activities slow down saving the workout to Apple Health. Is this an appropriate use of workout activities? If so, it would be great to be able to set the activity type for each activity (e.g. run or walk).
Replies
1
Boosts
0
Views
47
Activity
2d
Improved Treadmill Tracking for third party apps
How can third party workout apps take advantage of the announced improvements to treadmill workouts metric tracking? Are those improvements available on both watchOS and iOS?
Replies
1
Boosts
0
Views
55
Activity
2d