I'm new in Swift and i want to read the electrodermal activity from an apple watch series 7. In my code i'm using a query for HR following the documentation, when i execute de query the result contains nothing, i'm wearing the apple watch so i want to supose there will be information to read. I supose is a problem with the types but i can't see it.
guard let GSR = HKObjectType.quantityType(forIdentifier: .electrodermalActivity)
else{
return
}
let startDate = Calendar.current.date(byAdding: .month, value: -1, to: Date())
let predicate = HKQuery.predicateForSamples(withStart: startDate, end: Date(), options: .strictEndDate)
let sortDescriptor = NSSortDescriptor(key: HKSampleSortIdentifierStartDate, ascending: false)
let queryGSR = HKSampleQuery(sampleType: GSR, predicate: predicate, limit: Int(HKObjectQueryNoLimit), sortDescriptors: [sortDescriptor]) {(sample, result, error) in
guard error == nil else {
return
}
I don't know how to read the electrodermal activity, this query works for heart rate.