I've tried calling the addMetadata method on HKLiveWorkoutBuilder but I receive this cryptic error:
Code Block HKLiveWorkoutBuilder_DB2D [E6B9]: (#w0) Failed to restart task server after connection invalidation: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 created from an endpoint was invalidated from this process." UserInfo={NSDebugDescription=The connection to service on pid 0 created from an endpoint was invalidated from this process.}
Here's my code:
Code Block Swift backend = try! HKWorkoutSession(healthStore: healthStore, configuration: workoutConfiguration) builder = session?.associatedWorkoutBuilder() let metadata : NSDictionary = [ HKMetadataKeySyncIdentifier : match.syncIdentifier, HKMetadataKeySyncVersion: match.syncVersion ] builder.addMetadata(metadata as! [String : Any]) { (success, error) in ... } session.delegate = self builder.delegate = self ...