A query to access the location data stored in a workout route.
- iOS 11.0+
- watchOS 4.0+
A route sample can contain a considerable amount of data (for example, several thousand
CLLocation objects for a marathon). To manage this data, the query asynchronously returns the locations in batches. The location objects should have an accuracy of 50 meters or less; however, your app may want to perform additional smoothing before using the data.
To run a route query:
Create a query object, providing a block to receive the location data.
Call the HealthKit store’s
execute(_:)method to run the query.
Receive the route data. Your block receives one or more batches of location data. When the block’s
true, you have received all the data.
(Optional) Call the HealthKit store’s
stop(_:)method to stop the query early.