This is an ongoing issue that I haven't been able to solve:
I am querying different types of HealthKit data over the past year. While this works fine for HRV, it hangs for some users when I'm trying to get heart rate data.
Here's the relevant query
func initialRead(from startDate: Date) async throws -> [HKSample] {
let endDate = anchorStart
let interval: TimeInterval = .days(7)
var currentStartDate = startDate
var currentEndDate = Date(timeInterval: interval, since: currentStartDate)
var samples: [HKSample] = []
while currentStartDate <= endDate {
let datePredicate = SampleType.datePredicate(start: currentStartDate, end: currentEndDate)
let predicate = NSCompoundPredicate(andPredicateWithSubpredicates: [datePredicate,HKQuery.predicateForObjects(withMetadataKey: HKMetadataKeyHeartRateMotionContext, allowedValues: [HKHeartRateMotionContext.sedentary])])
do {
let result = try await withCheckedThrowingContinuation { continuation in
let completionQuery = HKSampleQuery(sampleType: HKQuantityType.heartRate, predicate: predicate, limit: HKObjectQueryNoLimit, sortDescriptors: [.init(key: HKSampleSortIdentifierStartDate, ascending: true)]) { query, samples, error in
if let samples {
continuation.resume(returning: samples)
} else {
if let error {
continuation.resume(throwing: error)
} else {
continuation.resume(returning: [])
}
}
}
healthStore.execute(completionQuery)
}
samples = samples.merge(from: result)
} catch {
Logger.general.error("Reading failed for dates \(currentStartDate) to \(currentEndDate): \(error)")
}
currentStartDate = currentEndDate
currentEndDate = Date(timeInterval: interval, since: currentStartDate)
}
return samples
}
extension HKSampleType {
static func datePredicate( start:Date?, end:Date?) -> NSPredicate {
HKQuery.predicateForSamples(withStart: start, end:end, options: .strictStartDate)
}
}
For reference, I expect about 1000 sedentary samples per week. Basically what happens for these users is when they start reading the HR data, the app hangs. They start each read manually via a special TestFlight build with buttons for starting the different data type readings.
Any advice on how to proceed with this bug would be great since it only affects some users.
I am able to create test builds for this audience to test different options. One theory is the motion context predicate is screwing something up. If any apple dev can enlighten me how to narrow down the issue, that would be great.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Related to this thread https://developer.apple.com/forums/thread/737819
I can confirm (again) that GPS performance on the watch Ultra (and likely all watches on watchOS 10) had been severely degraded.
Here is a swim that I did with both an Apple Watch Series 4 on watchOS 9 (green track) and a watch Ultra on watch OS 10.1 (blue track).
While the Series 4 provides relatively accurate data, the Watch Ultra provides very poor data with criss crossing paths and ridiculous data points.
Apple did respond to my feedback with the usual request for sysdiagnose but this has not progressed. FB13192409
Hi,
I'm the developer of Open Water Swim, and I have had multiple reports and have also confirmed with my own testing that the WatchOS 10 update has seriously degraded GPS data during open water swimming, both with the native Workout app and with Open Water Swim. The data provided by CoreLocation is no longer accurate or trustworthy. I will post several pictures showing before and after update swims:
Here's the raw data (mapped) of a swim done with watchOS 9 on the Ultra.
Same swim today:
From another pair of users: These two went TOGETHER, one with watchOS 9 and one with watchOS 10. You can probably guess which is which.
Watch OS 9 swim:
SAME SWIM WITH A PARTNER ON WATCHOS 10 (beta here)
And another, again, two people swimming together, one watchOS 9 and one watchOS 10.
watchOS 9
Same swim, same time, watchOS 10
I have filed two feedback assistant reports with APPLE. One when it was still a beta issue: FB12587468. This one has zero response from apple.
And now a second one filed with watchOS 10 release: FB13192409
Apple devs, I know you're here and listening, so please let's get this fixed ASAP. Thanks
Topic:
App & System Services
SubTopic:
Core OS
Tags:
watchOS
Health and Fitness
Apple Watch
WorkoutKit