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
Are you using an HKWorkoutRouteBuilder retrieved from you HKLiveWorkoutBuilder?
Our recommendation is for you to use seriesBuilder(for:) in the workout builder to initialize your route builder. Then at the time of ending your workout, when calling finishWorkout on HKLiveWorkoutBuilder the route will be saved and added to the workout. No need to finish the route builder.