1

In which format does HKObserverQuery gets data? There is no NSArray or NSDictionary to store data then how to get. I am putting the query put not able to get all data, anyone please help?

HKObserverQuery *query =
[[HKObserverQuery alloc]
 initWithSampleType:object
 predicate:Predicate
 updateHandler:^(HKObserverQuery *query,
                 HKObserverQueryCompletionHandler completionHandler,
                 NSError *error) {
[HKUnit unitFromString:@"count/min"]];


     if (error) {

         // Perform Proper Error Handling Here...
         NSLog(@"*** An error occured while setting up the stepCount observer. %@ ***",
               error.localizedDescription);
         abort();
     }
     else{
         NSLog(@"@%",query);
         }

 }];
Tejas Ardeshna
  • 4,343
  • 2
  • 20
  • 39

1 Answers1

1

HKObserverQuery is not intended to deliver data to your app. The updateHandler is simply called whenever a HKSample matching your predicate is added or removed from HealthKit. It is then up to your app to perform additional queries in response, such as HKSampleQuery or HKStatisticsQuery.

Allan
  • 7,039
  • 1
  • 16
  • 26