watch os 9 sleep analysis is not accurate as health app

        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?

Hello,

From the look at your query it seems like you're fetching all REM samples in the health database where in your screenshot it appears you're looking at just one day of data. Perhaps that's the discrepancy you're seeing?

Thanks

watch os 9 sleep analysis is not accurate as health app
 
 
Q