I'm using following filters to fetch swimming activities from HealthKit.
For some users it fetches all workouts (pool && open water) but for other it skips some open water activities. See screenshot, all those swimming activities are not fetched by following code.
let startDate = Calendar.current.date(byAdding: .month, value: -1, to: Date())!
let endDate = Date()
let swimmingPredicate = HKQuery.predicateForWorkouts(with: .swimming)
let timePredicate = HKQuery.predicateForSamples(withStart: startDate, end: endDate, options: .strictStartDate)
let predicate = NSCompoundPredicate(andPredicateWithSubpredicates: [swimmingPredicate, timePredicate])
let query = HKSampleQuery(sampleType: .workoutType(),
predicate: predicate,
limit: HKObjectQueryNoLimit,
sortDescriptors: [.init(keyPath: \HKSample.startDate, ascending: false)],
resultsHandler: { [weak self] query, samples, error in
...
Could someone help with ideads what is missing in this case?