Puzzling error using HKWorkoutRouteBuilder

When I insert route data into HKWorkoutRouteBuilder I get the following error:


The connection to service named com.apple.healthd.server was interrupted, but the message was sent over an additional proxy and therefore this proxy has become invalid


Here's a code snippet.


        workoutRouteBuilder.insertRouteData(filteredLocations) { (success, error) in
            if !success {
                print("inserting route data failed with error: \(String(describing: error))")
            }
        }


I patterned by impelementation from the Speed Sloth example.


Any insights would be appreciated!

Accepted Reply

The solution was that I forgot to ask for the HKObjectType.workoutType() permission. A better error message would have been helpful 🙂

Replies

I see the same error also basing my code on Speedy Sloth

Did you request the permission for HKSeriesType.workoutRoute()?

That made my error go away.


But now I have no error but can't see the route in the Activity App. Only the Workout itself... but the route isn't there 😟 Any idea?

Only a few workouts are supported e.g running, walking, and cycling. Make sure you have the workout metadata with "Outdoor"

The solution was that I forgot to ask for the HKObjectType.workoutType() permission. A better error message would have been helpful 🙂