diff --git a/RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.m b/RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.m index 92ccf2b775f743a453621cae250edabbc0c7c708..c084375d920e63d634d9ead15c75220714d65aa8 100644 --- a/RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.m +++ b/RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.m @@ -87,20 +87,12 @@ HKUnit *unit = [RCTAppleHealthKit hkUnitFromOptions:input key:@"unit" withDefault:[HKUnit countUnit]]; NSUInteger limit = [RCTAppleHealthKit uintFromOptions:input key:@"limit" withDefault:HKObjectQueryNoLimit]; BOOL ascending = [RCTAppleHealthKit boolFromOptions:input key:@"ascending" withDefault:false]; - NSDate *startDate = [RCTAppleHealthKit dateFromOptions:input key:@"startDate" withDefault:nil]; - NSDate *endDate = [RCTAppleHealthKit dateFromOptions:input key:@"endDate" withDefault:[NSDate date]]; - if(startDate == nil){ - callback(@[RCTMakeError(@"startDate is required in options", nil, nil)]); - return; - } HKQuantityType *stepCountType = [HKObjectType quantityTypeForIdentifier:HKQuantityTypeIdentifierStepCount]; - NSPredicate * predicate = [RCTAppleHealthKit predicateForSamplesBetweenDates:startDate endDate:endDate]; - [self fetchQuantitySamplesOfTypeByAnchor:stepCountType unit:unit - predicate:predicate + predicate:nil ascending:ascending limit:limit completion:^(NSDictionary *results, NSError *error) { diff --git a/RCTAppleHealthKit/RCTAppleHealthKit+Methods_Sleep.m b/RCTAppleHealthKit/RCTAppleHealthKit+Methods_Sleep.m index e28409762b53fee242d909c144fb37f4b10ca742..ecdd062ceca95161f7711e7edca52783d1656b3e 100644 --- a/RCTAppleHealthKit/RCTAppleHealthKit+Methods_Sleep.m +++ b/RCTAppleHealthKit/RCTAppleHealthKit+Methods_Sleep.m @@ -45,17 +45,9 @@ - (void)sleep_getSleepSamplesByAnchor:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback { - NSDate *startDate = [RCTAppleHealthKit dateFromOptions:input key:@"startDate" withDefault:nil]; - NSDate *endDate = [RCTAppleHealthKit dateFromOptions:input key:@"endDate" withDefault:[NSDate date]]; - if(startDate == nil){ - callback(@[RCTMakeError(@"startDate is required in options", nil, nil)]); - return; - } - - NSPredicate *predicate = [RCTAppleHealthKit predicateForSamplesBetweenDates:startDate endDate:endDate]; NSUInteger limit = [RCTAppleHealthKit uintFromOptions:input key:@"limit" withDefault:HKObjectQueryNoLimit]; - [self fetchSleepCategorySamplesForPredicateByAnchor:predicate + [self fetchSleepCategorySamplesForPredicateByAnchor:nil limit:limit completion:^(NSDictionary *results, NSError *error) { if(results){ diff --git a/RCTAppleHealthKit/RCTAppleHealthKit+Methods_Vitals.m b/RCTAppleHealthKit/RCTAppleHealthKit+Methods_Vitals.m index 132ff4a8f95997a3dddb6254c56d9dc0a72a2567..26e199403b0a83c23db54bdb329bf1db2676ee41 100644 --- a/RCTAppleHealthKit/RCTAppleHealthKit+Methods_Vitals.m +++ b/RCTAppleHealthKit/RCTAppleHealthKit+Methods_Vitals.m @@ -50,17 +50,10 @@ HKUnit *unit = [RCTAppleHealthKit hkUnitFromOptions:input key:@"unit" withDefault:[count unitDividedByUnit:minute]]; NSUInteger limit = [RCTAppleHealthKit uintFromOptions:input key:@"limit" withDefault:HKObjectQueryNoLimit]; BOOL ascending = [RCTAppleHealthKit boolFromOptions:input key:@"ascending" withDefault:false]; - NSDate *startDate = [RCTAppleHealthKit dateFromOptions:input key:@"startDate" withDefault:nil]; - NSDate *endDate = [RCTAppleHealthKit dateFromOptions:input key:@"endDate" withDefault:[NSDate date]]; - if(startDate == nil){ - callback(@[RCTMakeError(@"startDate is required in options", nil, nil)]); - return; - } - NSPredicate * predicate = [RCTAppleHealthKit predicateForSamplesBetweenDates:startDate endDate:endDate]; [self fetchQuantitySamplesOfTypeByAnchor:heartRateType unit:unit - predicate:predicate + predicate:nil ascending:ascending limit:limit completion:^(NSDictionary *results, NSError *error) { @@ -193,17 +186,10 @@ HKUnit *unit = [RCTAppleHealthKit hkUnitFromOptions:input key:@"unit" withDefault:[HKUnit millimeterOfMercuryUnit]]; NSUInteger limit = [RCTAppleHealthKit uintFromOptions:input key:@"limit" withDefault:HKObjectQueryNoLimit]; BOOL ascending = [RCTAppleHealthKit boolFromOptions:input key:@"ascending" withDefault:false]; - NSDate *startDate = [RCTAppleHealthKit dateFromOptions:input key:@"startDate" withDefault:nil]; - NSDate *endDate = [RCTAppleHealthKit dateFromOptions:input key:@"endDate" withDefault:[NSDate date]]; - if(startDate == nil){ - callback(@[RCTMakeError(@"startDate is required in options", nil, nil)]); - return; - } - NSPredicate * predicate = [RCTAppleHealthKit predicateForSamplesBetweenDates:startDate endDate:endDate]; [self fetchCorrelationSamplesOfTypeByAnchor:bloodPressureCorrelationType unit:unit - predicate:predicate + predicate:nil ascending:ascending limit:limit completion:^(NSDictionary *results, NSError *error) { diff --git a/RCTAppleHealthKit/RCTAppleHealthKit+Queries.m b/RCTAppleHealthKit/RCTAppleHealthKit+Queries.m index ea4c6ed10df4af310c90ab2144757cc559b590c1..bdb19107f3c5518c557c5bc81e8024528e1f82c9 100644 --- a/RCTAppleHealthKit/RCTAppleHealthKit+Queries.m +++ b/RCTAppleHealthKit/RCTAppleHealthKit+Queries.m @@ -568,7 +568,7 @@ HKQueryAnchor *anchor = [NSKeyedUnarchiver unarchiveObjectWithData:data]; HKAnchoredObjectQuery *anchorQuery = [[HKAnchoredObjectQuery alloc] initWithType:quantityType - predicate:predicate + predicate:nil anchor:anchor limit:lim resultsHandler:anchorHandlerBlock]; @@ -630,7 +630,7 @@ HKQueryAnchor *anchor = [NSKeyedUnarchiver unarchiveObjectWithData:data]; HKAnchoredObjectQuery *anchorQuery = [[HKAnchoredObjectQuery alloc] initWithType:quantityType - predicate:predicate + predicate:nil anchor:anchor limit:lim resultsHandler:anchorHandlerBlock];