Questions tagged [hksamplequery]

HKSampleQuery is an API included in Apple's iOS HealthKit framework that provides a way to search for specific aspects of a user's health data.

From Apple's documentation:

HealthKit uses sample queries to search for sample data in the HealthKit store. You can use sample queries to search for any concrete subclasses of the HKSample class, including HKCategorySample, HKCorrelation, HKQuantitySample, and HKWorkout objects.

59 questions
0
votes
1 answer

Health kit still return deleted data when I use Delete All action from Health App

I'm using health kit to get blood pressure from Health App,I have a strange behavior : I add a new data from health app, it appears correctly on my client app, When I remove that data from health app using Delete All action, my client App still…
0
votes
1 answer

watchOS 2 HealthKit HKSampleQuery Crash

So I am having problems debugging a crash on a distributed app. I cannot reproduce this crash personally. However, it seems that a large number of users are having an issue. I suspect it is do with the HKSampleQuery and possibly a return of no…
Simon
  • 304
  • 2
  • 17
0
votes
1 answer

Can I keep reading steps with HealthKit?

The purpose is trigger a method when the user walks the required steps. here is my code: if ([HKHealthStore isHealthDataAvailable]) { self.healthStore = [[HKHealthStore alloc] init]; NSSet *stepsType =[NSSet…
Cokile Ceoi
  • 1,326
  • 2
  • 15
  • 26
0
votes
1 answer

Executing functions and blocks through time

I don't understand how Objective-C loop system works. I have function (hope names are right, rather check in code) which executes query from Health Kit. I got my mind blown when I realised that function pass return value before query…
Lolipop52
  • 25
  • 8
0
votes
1 answer

WatchKit App only returning some HealthKit Data

I have the below method running in both my IOS app and my WatchKit App (Xcode 7 GM). The IOS app returns all of my running workouts, however the Watchkit app returns only the first 2 running workouts. Any idea? func…
GarySabo
  • 5,806
  • 5
  • 49
  • 124
0
votes
1 answer

Sort HKSampleQuery items by Quantity

I want to fetch HealthKit quantity data and sort them by quantity value. Is it possible? I know I can filter them by using HKPredicateKeyPathQuantityin the NSPredicate but I can't find similar key for sorting Example let type =…
Kostiantyn Koval
  • 8,407
  • 1
  • 45
  • 58
0
votes
1 answer

Swift2 - HKSampleQuery

let hkSampleType:HKSampleType = HKSampleType.correlationTypeForIdentifier(HKCorrelationTypeIdentifierFood)! let query = HKSampleQuery(sampleType: hkSampleType, predicate: predicate, limit: 80, sortDescriptors: nil, resultsHandler: {…
Bogdan Bogdanov
  • 882
  • 11
  • 36
  • 79
0
votes
1 answer

HealthKit Observer not working while app is in background mode

I have followed Apple Docs and Several threads on stackoverflow on how to achieve background fetching of data from Health Store. So far I have: Added HealthKit Entitlement to my appID Added Required Background Modes Added the code to…
Hugo Alonso
  • 6,684
  • 2
  • 34
  • 65
0
votes
0 answers

Heart Rate data monthly

I am retrieving heart rate from Health Kit in my app. however i get the latest data from Health Kit, how can i get the data monthly wise? I mean last reading from each month.. i saw NSPredicate can be used to do so but i am not getting exactly how…
ash_win
  • 195
  • 2
  • 10
0
votes
2 answers

Obtaining results from HKObserverQuery

I posted Setting up HKObserverQuery using Swift a few days ago. I was wondering also, if there is a way to get the value of the most recent data point that was just added into HealthKit using the HKObserverQuery, or does it just let you know that…
GenerationDebt
  • 89
  • 1
  • 1
  • 8
0
votes
1 answer

HealthKit HKSampleQuery Heart rate readings

I'm trying to get heart rate readings through the healthkit store using HKSampleQuery, but I keep getting count/s. Is there anyway I can get it by count/minute?
iiat
  • 3
  • 2
-1
votes
1 answer

How do I the amount of time spent sleeping in the previous day with HealthKit and Swift?

I'm trying to use HealthKit to determine the amount of time the user spent sleeping in the 24 hours previous to the query. I've requested permission from the user to read step and sleep data and, while I can read step data without any trouble, my…
-1
votes
1 answer

The number 0 is being returned every time in HealthKit using swift?

I have been successfully able to write to HealthKit but receiving these values always return 0. I am trying to return the latest value of weight. This is the function that I read weight: public func readWeight(result: @escaping (Double) -> Void) { …
arodebaugh
  • 538
  • 1
  • 8
  • 26
-1
votes
1 answer

Access Data step count from Health app of Apple

I would like to show in my app a label of my step count The data step count will be take from the health app of apple but i don't know if will be possible how i can print the value of my step count in a label ? This is my code Thanks #import…
1 2 3
4