Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
QueryRecentLogs.m
HKSampleQuery *query = [[HKSampleQuery alloc] initWithSampleType:[HKQuantityType quantityTypeForIdentifier:HKQuantityTypeIdentifierDistanceWalkingRunning]
predicate:[HKSampleQuery predicateForObjectsWithNoCorrelation]
limit:20
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
You can’t perform that action at this time.