let stagePredicate = HKCategoryValueSleepAnalysis.predicateForSamples(.equalTo,value: .asleepREM)
let queryPredicate = HKSamplePredicate.sample(type: HKCategoryType(.sleepAnalysis), predicate: stagePredicate)
let sleepQuery = HKSampleQueryDescriptor(predicates: [queryPredicate], sortDescriptors: [])
do{
let sleepSample = try await sleepQuery.result(for: store)
print("sleep sample ")
print(sleepSample)
with health app on iOS , it says I did rem sleep for 59 minutes. but all sum of sleep sample time is not 59 but 3.7hours. time is also not accurate.
sleepSample log is as below
what may be the problem?