Post not yet marked as solved
I'm using watchOS 9 beta 2 and I'm not getting the new running metrics in my workout app.
Using HKLiveWorkoutDataSource attached to a HKWorkoutBuilder
ActivityType is running
Tried enabling the collection of the new metrics
According to Jorge M in the WWDC labs:
"Yes, the new running metrics are also available for 3rd party applications. If you are using an HKLiveWorkoutDataSource attached to a HKWorkoutBuilder in your application, the new metrics would be collected by default."
The Health app does not show any Related Samples for these types. Am I doing something wrong or are they not available yet to 3rd party workouts? I do see them for the Apple Workout app.
Post not yet marked as solved
Hi.
is there a explicit HKQuantityTypeIdentifier for the new Cadence value in iOS 16.
I only can find in the documentation HKQuantityTypeIdentifier
runningPower
runningSpeed
runningStrideLength
runningVerticalOscillation
runningGroundContactTime
But nothing like runningCadence???
Post not yet marked as solved
Will developers be able to access the AFib History feature coming to WatchOS 9? I work as an Epic Analyst for a local hospital in the digital health department and one of our programs uses the Apple Watch for AFib detection and I just wanted to make sure we would be able to access that info (with permission of course) through our own app.
Post not yet marked as solved
Is it possible to set TotalDistance for the sorts of HKSampleQueryDescriptor?
In HKSampleQuery, I can set TotalDistance as follows.
let sort = NSSortDescriptor(key: HKWorkoutSortIdentifierTotalDistance, ascending: false)
let type = HKWorkoutType.workoutType()
let query = HKSampleQuery(sampleType: type, predicate: nil, limit: 0, sortDescriptors: [sort] ){
(query, results, error) -> Void in
}
I want to create a SortDescriptor for HKSampleQueryDescriptor.
When I set HKWorkout.totalDistance to parameter in SortDescriptor, the compile error occurred.
let sort = SortDescriptor(\HKWorkout.totalDistance, order: .forward)
// Error: "No exact matches in call to initializer"
I know that HKWorkout.totalDistance is deprecated.
Isn't it recommended to set TotalDistance to sort?
I'm expecting that on iOS 16, I can get my workouts in heart rate order, is this a mistake?
Post not yet marked as solved
let stepType = HKQuantityType(.stepCount)
let stepsThisWeek = HKSamplePredicate.quantitySample(type: stepType, predicate: thisWeek)
let yesterday = calendar.date(byAdding: .day, value: -1, to: calendar.startOfDay(for: now))
let every5 = DateComponents(minute:5)
let healthTypes = Set([
HKCategoryType.categoryType(forIdentifier: .handwashingEvent)!
])
let sumOfStepsQuery = HKStatisticsCollectionQueryDescriptor(
predicate: stepsThisWeek,
options: .cumulativeSum,
anchorDate: endDate,
intervalComponents: every5)
do {
let updateQueue = sumOfStepsQuery.results(for: store)
// Wait for the initial results and updates.
updateQueue = Task {
for try await results in updateQueue {
// Use the statistics collection here.
}
}
} catch {
//handle error
print(error)
}
Post not yet marked as solved
I want to query to washing event.
but washing hand is HKCategoryType so I can't use HKStatiticsCollectionQueryDescriptor because it only accept HKQuantitySample.
is there a way that I can use it ?