Skip to content

Instantly share code, notes, and snippets.

Created October 23, 2014 05:34
What would you like to do?
HKSampleQuery *query = [[HKSampleQuery alloc] initWithSampleType:[HKQuantityType quantityTypeForIdentifier:HKQuantityTypeIdentifierDistanceWalkingRunning]
predicate:[HKSampleQuery predicateForObjectsWithNoCorrelation]
sortDescriptors:@[[NSSortDescriptor sortDescriptorWithKey:HKSampleSortIdentifierEndDate ascending:NO]]
resultsHandler:^(HKSampleQuery *query, NSArray *results, NSError *error) {
dispatch_async(dispatch_get_main_queue(), ^{
_runLogs = [NSMutableArray arrayWithArray:results];
[_tblRunLog reloadData];
// don't forget to run the query after you create it!
[_healthStore executeQuery:query];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment