I have written two difference types of predicates and both give me different results as compared to the health app. I am sure this has something to do with 12am, around when I take a little walk.
Here are the two predicates...
The data in the health app is ...
Yesterday: 1714
Today: 1076
The data I get with the first predicate is...
Yesterday: 1559
Today: 917
with the second predicate is...
Yesterday: 1874
Today: 917
Note: They even don't total up to be the same as each other or the health app data.
Here is my code that calculates the total...
Please help me set a predicate which make the Health app data and my data to be the same.
Thanks.
Here are the two predicates...
Code Block NSPredicate *daySearchPredicate = [NSPredicate predicateWithFormat:@"startDate>=%@ && startDate<%@ && endDate>=%@ && endDate<%@",historyDate,nextDate,historyDate,nextDate];
Code Block NSPredicate *daySearchPredicate = [NSPredicate predicateWithFormat:@"startDate>=%@ && startDate<%@",historyDate,nextDate];
The data in the health app is ...
Yesterday: 1714
Today: 1076
The data I get with the first predicate is...
Yesterday: 1559
Today: 917
with the second predicate is...
Yesterday: 1874
Today: 917
Note: They even don't total up to be the same as each other or the health app data.
Here is my code that calculates the total...
Code Block //calculate total steps for today int64_t steps=0; for (HKQuantitySample *stepsSample in stepsPredicateResultsArray) { HKQuantity *stepsQuantity = [stepsSample quantity]; int64_t currentSampleSteps = (int64_t)[stepsQuantity doubleValueForUnit:[HKUnit countUnit]]; steps = steps + currentSampleSteps; } hObject.steps=steps;
Please help me set a predicate which make the Health app data and my data to be the same.
Thanks.