Created
October 23, 2014 05:34
-
-
Save jault3/ec82d70e932210c19b31 to your computer and use it in GitHub Desktop.
QueryRecentLogs.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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