Hi,
The fitness features such as distance moved, steps, calories burned is it in HealthKit or in a different kit ? couldn't find any API in HealthKit ?
Also for example how can Apple Watch distinguish that this amount of steps was walked and not moved by a slow car or a scoter for example ?
Kindest Regards
Health and Fitness
RSS for tagUse HealthKit to enable your iOS and watchOS apps to work with the Apple Health app.
Posts under Health and Fitness tag
65 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
Hello,
The new mental health features in iOS 17 allow users to log their momentary emotions and daily moods, see valuable insights, and easily access assessments and resources. Does anyone know if HealthKit in iOS 17 provides an API for accessing these records? Thanks :)
I'm using the new watchOS 9 HKWorkoutActivity in my interval training app (Intervals Pro) for each interval. It's a great addition since all the intervals now show in the Apple Fitness app, however, if the workout has lots of activities then saving the workout is painfully slow. For example, on my Apple Watch Ultra I saved a workout with 63 activities and it took more than 1 minute. Here's a code snippet:
try await builder.endCollection(at: workoutEndDate)
try await builder.addMetadata(metadata)
try await builder.finishWorkout() // This is SLOW
Is anyone else having the same issue?
To demonstrate the issue you can look at a Test Flight build of Intervals Pro:
https://testflight.apple.com/join/Nn7iSOzY
Tap on the More tab in the iPhone app and then the Apple Watch Settings. On that screen you'll see a switch to either enable or disable workout activities. To demonstrate the issue, edit a timer to continue until manually stopped by changing the Number of Cycles to "Until Stopped". Then start the timer on the watch. Let it run for a period of time to create more than 50 intervals, for example, then stop the timer. Swipe to the leftmost screen on the watch, tap pause, then tap end. At that point you'll see how slow the workout saved.
Next, you can go back to the iPhone app, disable using workout activities and repeat the test. The workout will save quickly in this case.
I've filed a feedback.
Is there way to read the Apple Heart rate zones from HealthKit? I want to read the min/max bpm for each of the 1-5 zones.
I went through the Apple HealthKit developer documentation but couldn't find it https://developer.apple.com/documentation/healthkit
I developed an iPhone/Watch app with the single target setting (new method) for Watch app projects, which will be available from Xcode14. This app uses HealthKit to retrieve information such as step count and heart rate from healthcare. The watch app is not independent and requires the iPhone app (companion app).
Regarding the permission to access health care, i found some differences from the Old WatchApp Project (application project structure using WatchExtension when Xcode 13.4 or lower is used).
This does not occur in the iPhone simulator or watch simulator, but only on the actual device.
Both the iPhone app and watch app now display a dialog to allow access to health care
In the Old WatchApp Project, if access was granted in either app, the granted access is synchronized.
When checking the Health Care access status in the iPhone Settings App, permission settings for both the iPhone app and watch app are displayed independently.
Because each permission setting is independent, you can choose to allow access to the iPhone app but not to allow it to the watch app.
the Old WatchApp Project, permission settings for the iPhone app and watch app were synchronized, so it was not possible to have different settings for each.
These behaviors are not described in the documentation.
It would be understandable if the transition from watch "extension" to watch "app" is to split the app into two separate units.
However, since there is no official documentation explaining this, i cannot determine whether this is the correct specification or not.
Furthermore, since the companion app is required rather than a separate Watch app, having the Health Care permission settings out of sync with the companion app could cause unexpected problems and worsen the user experience.
(It would be difficult and cumbersome for the user to know what settings they have made).
Is there a solution to synchronize this behavior with the companion app like as the Old WatchApp Project?
Do i have to go back to the project configuration (use of watchExtension) before Xcode13?
I have prepared a sample project below that can test the above.
https://github.com/HayakawaAKIRA/SingleTargetWatchOSApp-HealthKit
reference:
https://developer.apple.com/videos/play/wwdc2022/10133/
https://developer.apple.com/documentation/watchkit/wkapplication
https://developer.apple.com/documentation/healthkit/setting_up_healthkit