I know this is the query to use if I want live updates for the calories spent, on watchOS?
- (HKQuery *)createStreamingCaloriesQueryFromDate:(NSDate *)startDate {
NSPredicate *predicate = [HKQuery predicateForSamplesWithStartDate:startDate endDate:nil options:HKQueryOptionNone];
HKQuantityType *type = [HKQuantityType quantityTypeForIdentifier:HKQuantityTypeIdentifierActiveEnergyBurned];
HKAnchoredObjectQuery *query = [[HKAnchoredObjectQuery alloc] initWithType:type
predicate:predicate
anchor:0
limit:0
resultsHandler:^(HKAnchoredObjectQuery * _Nonnull query, NSArray<__kindof HKSample *> * _Nullable sampleObjects, NSArray<HKDeletedObject *> * _Nullable deletedObjects, HKQueryAnchor * _Nullable newAnchor, NSError * _Nullable error) {
[self addCaloriesSamples:sampleObjects];
}];
[query setUpdateHandler:^(HKAnchoredObjectQuery * _Nonnull query, NSArray<__kindof HKSample *> * _Nullable sampleObjects, NSArray<HKDeletedObject *> * _Nullable deletedObjects, HKQueryAnchor * _Nullable newAnchor, NSError * _Nullable error) {
[self addCaloriesSamples:sampleObjects];
}];
return query;
}
Will this work on iOS as well, if my app is also adding heart rate samples and distance samples?