HKWorkoutRouteBuilder does not work

Hi


I get an error when doing insertRouteData of HKWorkoutRouteBuilder 😢.


Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.healthd.server" UserInfo={NSDebugDescription=connection to service named com.apple.healthd.server}


I would have allowed write permission of "Workout Route".

And I tried with the following code.

let builder = HKWorkoutRouteBuilder(healthStore:healthStore, device: nil)
let routeData:[CLLocation] = ...
builder.insertRouteData(routeData) { (success, error) in
   if let e = error { print(e) }
}


iOS: iOS 11 beta 3

WatchOS: watchOS 4 beta 3


What should I do to solve this error?


Thank you.

I have the same issue, and I think it's simply a bug in either the current beta or the Simulator (I can't test on an actual device running watchOS4 right now).

If you try out Apple's own demo of HKWorkoutRouteBuilder (https://developer.apple.com/library/content/samplecode/SpeedySloth/Listings/SpeedySloth_WatchKit_Extension_HealthStoreManager_swift.html), you will see it actually suffers the same issue.

It now works properly using Beta 4 🙂

I'm running watchOS 4 Beta 4 and I'm still having the same issue. Did you make any other changes? BTW, the demo app SpeedySloth is working for me now, but my app isn't.

Same for me: beta 4. SS works, my app doesn't. I am testing both on simulator

I'm running iOS 11 beta 8 and still getting the same error.


Error Domain=NSCocoaErrorDomain Code=4099 "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." UserInfo={NSDebugDescription=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.}


I'm simply calling insertRouteData to insert 10 locations into the builder and it fails. Perhaps HKWorkoutRouteBuilder doesn't work on iOS. Perhaps HKWorkoutRouteBuilder isn't yet working in Beta 8 of iOS 11. Perhaps a workout session has to be open. Who knows? It just seems like creating a builder and inserting a few locations is the simplest use case that ought to simply work. I haven't even gotten to the point of calling finishRoute.

HKWorkoutRouteBuilder does not work
 
 
Q