I'm trying to get all samples after a given startDate and have that query running for as long as the app is "alive" including background. I used
let predicate = HKQuery.predicateForSamples(withStart: queryStart, end: nil, options: HKQueryOptions.strictStartDate)
I thought: if its not specified it cannot be restricting…
From the results I am getting I infer that it's using the end of the day the query is executed as a restriction:
I am getting all updates the same day with the samplesUpdatequeryResultshandler but the next morning my app doesn't receive samples unless I restart it.
Edit: I should mention I am using options: HKQueryOptions.strictStartDate
Is it too much to ask that the documentation mention how nil is handled if it's allowed? One could omit the ? and everyone would know to specify the end date.
I'll now use
let queryEndDate = Calendar.current.date(byAdding: .year, value: 10, to: Date())!
See how that goes.