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
Topic:
App & System Services
SubTopic:
Health & Fitness
3
0
100