Creates, saves, and associates the route with the provided workout.
- iOS 11.0+
- Mac Catalyst 13.0+
- watchOS 4.0+
The workout to associate with the route. You must have already saved this workout to the HealthKit store.
The metadata dictionary can contain extra information describing this sample. The dictionary’s keys are all
NSStringobjects. The values may be
NSDateobjects. For a complete list of predefined metadata keys, see Metadata Keys.
Using predefined keys helps facilitate sharing data between apps; however, you are also encouraged to create your own custom keys as needed to extend the HealthKit quantity sample’s capabilities.
A block called after the system has saved the route data. The system passes the block the following parameters:
The workout route, or
nilif an error occurred. If successful, the system has already associated the route with the provided workout and saved it to the HealthKit store.
An object that describes the error, if an error has occurred; otherwise,
Call this method after adding all the route data to the builder. The builder creates the route and saves it to the HealthKit store. It also associates the route with the provided workout. You cannot associate the route with another workout.
This method fails if you haven’t added any location data to the builder. The completion handler returns an error and
nil for the route.
Additionally, this method invalidates the builder. Any further calls to the builder returns an error. To subsequently access the workout route, use a query (for example, an