Commit e1e5b66b authored by Furyou81's avatar Furyou81

add

parent d8309cc4
...@@ -336,16 +336,16 @@ ...@@ -336,16 +336,16 @@
NSCalendar *calendar = [NSCalendar currentCalendar]; NSCalendar *calendar = [NSCalendar currentCalendar];
NSDateComponents *interval = [[NSDateComponents alloc] init]; NSDateComponents *interval = [[NSDateComponents alloc] init];
interval.day = 1; //interval.day = 1;
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"metadata.%K != YES", HKMetadataKeyWasUserEntered];
NSDateComponents *anchorComponents = [calendar components:NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear NSDateComponents *anchorComponents = [calendar components:NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear
fromDate:[NSDate date]]; fromDate:[NSDate date]];
anchorComponents.hour = 0; //anchorComponents.hour = 0;
NSDate *anchorDate = [calendar dateFromComponents:anchorComponents]; NSDate *anchorDate = [calendar dateFromComponents:anchorComponents];
// Create the query // Create the query
HKStatisticsCollectionQuery *query = [[HKStatisticsCollectionQuery alloc] initWithQuantityType:quantityType HKStatisticsCollectionQuery *query = [[HKStatisticsCollectionQuery alloc] initWithQuantityType:quantityType
quantitySamplePredicate:nil quantitySamplePredicate:predicate
options:HKStatisticsOptionCumulativeSum options:HKStatisticsOptionCumulativeSum
anchorDate:anchorDate anchorDate:anchorDate
intervalComponents:interval]; intervalComponents:interval];
...@@ -391,16 +391,16 @@ ...@@ -391,16 +391,16 @@
NSCalendar *calendar = [NSCalendar currentCalendar]; NSCalendar *calendar = [NSCalendar currentCalendar];
NSDateComponents *interval = [[NSDateComponents alloc] init]; NSDateComponents *interval = [[NSDateComponents alloc] init];
interval.day = 1; //interval.day = 1;
NSDateComponents *anchorComponents = [calendar components:NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear NSDateComponents *anchorComponents = [calendar components:NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear
fromDate:[NSDate date]]; fromDate:[NSDate date]];
anchorComponents.hour = 0; //anchorComponents.hour = 0;
NSDate *anchorDate = [calendar dateFromComponents:anchorComponents]; NSDate *anchorDate = [calendar dateFromComponents:anchorComponents];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"metadata.%K != YES", HKMetadataKeyWasUserEntered];
// Create the query // Create the query
HKStatisticsCollectionQuery *query = [[HKStatisticsCollectionQuery alloc] initWithQuantityType:quantityType HKStatisticsCollectionQuery *query = [[HKStatisticsCollectionQuery alloc] initWithQuantityType:quantityType
quantitySamplePredicate:nil quantitySamplePredicate:predicate
options:HKStatisticsOptionCumulativeSum options:HKStatisticsOptionCumulativeSum
anchorDate:anchorDate anchorDate:anchorDate
intervalComponents:interval]; intervalComponents:interval];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment