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!
UPDATE: Here's some more info from the watch logs. Looks like some sort of permission issue, but I haven't been able to track it down yet:
fault 13:21:14.664262 -0400 healthd connection from pid 1705: Warning: Exception caught during invocation of received message, dropping incoming message and invalidating the connection. Exception: Invalid parameter not satisfying: [authorizationStatuses count] == [typesIncludingParentTypes count] Invalid parameter not satisfying: [authorizationStatuses count] == [typesIncludingParentTypes count] ( 0 CoreFoundation
0x1dc04d25 + 153 1 libobjc.A.dylib
0x1d227181 objc_exception_throw + 39 2 CoreFoundation
0x1dc04be5 + 1 3 Foundation
0x1e43c1cd + 93 4 HealthDaemon
0x2edf678f + 2015 5 HealthDaemon
0x2ee6eed1 + 143 6 HealthDaemon
0x2ee6ec77 + 143 7 HealthDaemon
0x2ee7b99b + 485 8 HealthDaemon
0x2f0e1e1f + 143 9 Foundation
0x1e589393 + 19 10 Foundation
0x1e587<…>
I had the same problem. You need to ensure that you request authorisation from the user for:
// Objective C
[HKSeriesType workoutRouteType]
// Swift
HKSeriesType.workoutRoute()