I have FB12696743 open since July 21, 2023 and this happened again today.
I get home at approx 10 mins after the hour, walk appox 50 ft across my yard, up 5 steps into my house, let the dog out and pace on my deck watching the dog, go back in the house walk around the kitchen while preparing dinner. A total of about 200 ft. I sit down about 35 past the hour and start to eat and at 10 mins to the next our and I get the reminder to stand.
On the other side I wake up at 5 mins to hour. Walk 8 steps to the bathroom and successfully achieve the stand for that hour.
WHY!?!?!? 😁🤣
Use HealthKit to enable your iOS and watchOS apps to work with the Apple Health app.
Post
Replies
Boosts
Views
Activity
I'm currently trying to collect some of the following data whilst running a workout in a WatchOS app I'm building. Below are the data points I'm trying to retrieve:
HKQuantityType.init(.heartRate)
HKQuantityType.init(.oxygenSaturation)
HKQuantityType.init(.respiratoryRate)
HKQuantityType.init(.bloodPressureSystolic)
HKQuantityType.init(.bloodPressureDiastolic)
HKQuantityType.init(.heartRateVariabilitySDNN)
I'm using the following delegate function workoutBuilder(_:didCollectDataOf:) which is part of HKLiveWorkoutBuilderDelegate
Something I'm realising whilst running this on the simulator and on my Apple Watch is out of all of the Quantity types I'm requesting. Only the heart rate is being called via the delegate function when trying to retrieve the statistic.
Is this the intended behaviour of this API? Since there's no docs about what is and isn't exposed
Hi,
My app reports daily step counts, and I’m trying to use HKCumulativeQuantitySample to report them to HealthKit by adding such objects with each update:
let sample = HKCumulativeQuantitySample(type: .stepCount, quantity: HKQuantity(unit: HKUnit.count(), doubleValue: dailyTotal), start: startOfDay, end: nowDate)
However, HealthKit interprets them as regular samples—it sums them into a global aggregate instead of updating the daily cumulative value. So if I report the daily step count as 500 and then 550, HealthKit interprets it as 1,050 steps instead of 550.
Is this expected behavior? If so, what is HKCumulativeQuantitySample intended for, and how should it be used? I’m struggling to find any examples.
Thank you
I'm working on an app that reads and writes exercise minutes to HealthKit. Everything functions correctly up to iOS 18.0.1, but starting from iOS 18.1, my implementation is no longer working as expected.
Here's the code snippet I use to write to HealthKit:
let workout = HKWorkout(activityType: .other, start: startDate, end: endDate)
try await healthStore.save(workout)
This code successfully writes to both workouts and exercise minutes in iOS 18.0.1 and earlier. However, from iOS 18.1, it only writes to workouts and not to the exercise minutes data source.
Has anyone encountered this issue or have insights on how to resolve this?
We are seeing an issue where sending data using the asynchronous method HKWorkoutSession.sendToRemoteWorkoutSession(data: Data) will never return in some cases (no success nor failure).
This issue is happening for roughly 5% of Workouts started and will stay broken for the whole workout. The other 95% of the workouts, the connection works flawlessly. This happens on both watchOS 10 and 11, and with phones running iOS 17 or 18. The issue is quite random and not reproducible.
Our app has thousands of workouts a day that use the workout session workout data send, with constant messages being send every few seconds.
In some of those 5% cases the "sendToRemoteWorkoutSession" will throw way later, like 30+ minutes later, if the watch app is awake long enough to capture a log of a failure.
Our code uses the same flow as in the sample project:
https://developer.apple.com/documentation/healthkit/workouts_and_activity_rings/building_a_multidevice_workout_app
Here is some sample code, which is pretty simple.
Setup code:
let workoutSession = try HKWorkoutSession(healthStore: healthStore, configuration: configuration)
workoutSession.delegate = self
activeWorkoutSession?.startMirroringToCompanionDevice { success, error in
print("Mirroring started on companion device: \(success), error: \(error)")
}
workoutSession?.prepare()
then later we send data using the workout session:
do {
print("Will send data")
try await workoutSession.sendToRemoteWorkoutSession(data: data)
print("Successfully sent data") // This nor the error may be called after waiting extensive amounts of time
} catch {
print("Failed to send data, error: \(error)") // This nor the success may be called after waiting extensive amounts of time
}
So far, the only fix is to restart the phone and watch at the same time, which is not a great user experience.
Is anyone else seeing this issue? or know how to fix this issue?
My Apple Watch after the beta update is not syncing the activities sometimes with Apple Health.
I just completed a 2.5 km walk, and it showed on Apple Health, yes, but it did not affect my daily goals. This is not the first time this has happened; this is just one of the examples that I'm sharing, other than what has been some problems that I am seeing after the beta update.
Additionally, the camera remote app is not working correctly as I cannot see anything on the watch screen like I used to.
For a given date, there are discrepancies between the step counts obtained from HealthKit and those displayed in the Health app. Is it possible for such discrepancies to occur even if step counts are not manually entered and multiple devices are not being used?