Health & Fitness

RSS for tag

Explore the technical aspects of health and fitness features, including sensor data acquisition, health data processing, and integration with the HealthKit framework.

Health & Fitness Documentation

Posts under Health & Fitness subtopic

Post

Replies

Boosts

Views

Activity

Value of type 'Measurement<UnitEnergy>' has no member 'formatted'
I have just decided I want to make a watch app and am trying to familiarize myself with Xcode and Swift. So I decided to follow the Workout app for watchOs tutorial and the tutorial used this block of code. Text(      Measurement(       value: 47,       unit: UnitEnergy.kilocalories      ).formatted(        .measurement(         width: .abbreviated,         usage: .workout,         numberFormat: .numeric(          precision: .fractionLength(0)         )        )       )     ) However when I try to use this code I get the following error. Value of type 'Measurement<UnitEnergy>' has no member 'formatted' Im using XCode Version 12.5.1 Any help is appreciated!
0
0
589
Aug ’21
CareKit: Unable to adopt protocol 'OCKSurveyTaskViewControllerDelegate'
Hello all, this could surely be a newbie mistake but I'm unable to adopt this protocol to my class object I've created in a new project. The Error: "Cannot find type 'OCKSurveyTaskViewControllerDelegate' in scope" import CareKit import CareKitUI import CareKitStore import ResearchKit import UIKit import os.log final class CareFeedViewController: OCKDailyPageViewController, OCKTaskSurveyViewControllerDelegate { } However, I've been able to locate the 'OCKSurveyViewController.swift" file in the CareKit framework from SPM which has the protocol defined there, but I'm still unable to utilize it. Was the protocol only for demonstration purposes and not for use outside of the WWDC21 - CareKit Code Along?
1
0
1.4k
Jul ’23
Access to SpO2, EDA, ECG, and temperature?
I'm a researcher working for children with special needs such as ADHD. With my research group, we would like to use the Apple Smartwatch as a monitoring device in several health-related research projects. However, before buying a lot of devices, I need clear and detailed information about the accessibility of SpO2, EDA, ECG, and temperature raw data through the Apple watch. Will I be able to access raw data to embed in my customised app? If I need to develop an app that reads and processes through custom algorithms raw data coming from these sensors, is it possible? I just want clear and detailed information before buying a lot of devices.
1
0
1.2k
Sep ’21
Workout Distance summary is in miles. Can I make it meters?
Hello everyone, I'm making an app that saves rowing workouts. Rowing workouts are traditionally in meters. I want my workout summaries to always show in meters. I have created and saved a HKWorkout instance. For the totalDistance, I am saving a quantity that uses HKUnit.meter() as its unit. Any intervals that I've associated with the workout are also saved with HKUnit.meter() as the unit. When I look at the Workout in the Health app, it shows the total distance in miles. All the intervals are in miles as well Is there a special piece of metadata that I need to add to my workout to hint to the Health app that I'd like to always see the summary using meters? How can I get my workout to always be shown in meters in the health app? Thank you for your advice, _ michael
2
0
784
Aug ’21
stopDeviceMotionUpdates doesn't stop motion updates
I am new to Swift development. I am building my first WatchOS app that collects motion data. I am collecting motion data using startDeviceMotionUpdates with handler. However stopDeviceMotionUpdates doesn't stop the updates and handler goes in endless loop. class WatchMotionManager: ObservableObject {     let motion = CMMotionManager()     let queue = OperationQueue()     func startQueuedUpdates() {         motion.deviceMotionUpdateInterval = 1.0 / 50.0         motion.showsDeviceMovementDisplay = true         motion.startDeviceMotionUpdates(to: self.queue, withHandler: { (data, error) in                 if let motionData = data {                     //get data                  }         })     }          func stopQueuedUpdates() {     self.motion.stopDeviceMotionUpdates()     } }```
2
0
726
Sep ’21
Provisioning profile contains attribute that triggers error
I recently renewed a provisioning profile and now i'm getting the following warning (and failure when building during code signing): warning: Provisioning profile "[redacted]" for "OneMedly" contains entitlements that aren't in the entitlements file: com.apple.developer.healthkit.background-delivery. To use these entitlements, add them to your entitlements file. Otherwise, remove unused entitlements from your provisioning profile. (in target 'OneMedly' from project 'OneMedly') The app does use HealthKit and the provisioning profile (which apple generates) has HealthKit and if I inspect the provisioning profile, it does indeed contain this healthkit.background-delivery attribute. This doesn't seem to be problem for debug builds, only for release builds. Does anyone know what is causing this warning/error? Is there a workaround?
2
0
2.1k
Sep ’21
SwiftUI render wrong size on old devices like Apple Watch Series 4
Problem: SwiftUI render wrong size on old device like Apple Watch Series 4. The height was be cut, not well render as series 6 or simulator. Check the screenshots. BTW: But it works well both on watch series 6 real device or simulator. Reproduce: Download “Build a Workout App for Apple Watch”, run the code on a real device of watch series 4 https://developer.apple.com/videos/play/wwdc2021/10009/ On Watch4-44 mm (first line be clip) On Simulator or watch 6.
0
0
1k
Sep ’21
How to read sleep duration goal and sleep schedule
Hello everyone, I am in the process of building an app that gives the user more statistical information about their sleep, and I would like to access the sleep duration goal and the sleep schedule that the user can set in the Health app. Is it possible to access this information and if so, how do I do that? You are welcome to point me to the specific documentation, I just can't find anything about this in the documentation. Have a nice day, Simon
1
0
1.1k
Sep ’21
Issue testing the 'Verifiable Health Records' sample code
Hello, The new iOS 15 'Verifiable Health Records' sample code has an issue when I tap on the 'Request Samples' button: The call to HKVerifiableClinicalRecordQuery in ContentView.swift:63 comes back with an error: "Missing required entitlement identifier: verifiable-health-records" But it's unclear to me where I need to add this entitlement? In the Target , the HealthKit Capability is added with 'Clinical Health Records' selected. Is that not enough? I also added "Privacy - Health Records Usage Description" in the Info.plist, but that didn't resolve it. Thanks, Eiman
2
0
725
Oct ’21
HKSwimmingStrokeStyle in Fitness app
If I use the Apple training app for indoor swim workouts, I can see the distance by each swimming stroke style later in the Fitness app. However, if I build my own swim app, the distance by stroke style is not listed. What do I have to add, to have it listed there? The information are saved correct in the HKWorkoutEvent array in the workout.
1
0
1.4k
Dec ’21
How to add sample active energy to statistics when I use activity type other
Hello, i set up a watchOS app. I calculated the active burned energy by myself and add it every second as sample to the running workout builder. When I setup the statistics it sum up the app related burned energy for three times. Then the watchOS send active energy with 0. The samples are stored in the workout session but the total energy is 0. In the documentation apple wrote that if you use other you have to tell the system that the samples have to sum up. How I can do that?
0
0
412
Oct ’21
HealthKit finishRoute not connecting workout and route.
When using the code below, I can see both a workout and a workout route within the Apple Health app on simulator, however the two are not connected. On my iPhone 12 mini, I notice similar with workout data from the Strava app. whereas a workout recorded with the Apple Watch Fitness app, will have a workout with a related route. // Save workout to Health store builder.finishWorkout { theWorkout, error in     // Finish route     routeBuilder.finishRoute(with: theWorkout!, metadata: [:]) { workoutRoute, error in     } } Anyone else have this issue?
3
1
572
Nov ’21
Value of type 'Measurement<UnitEnergy>' has no member 'formatted'
I have just decided I want to make a watch app and am trying to familiarize myself with Xcode and Swift. So I decided to follow the Workout app for watchOs tutorial and the tutorial used this block of code. Text(      Measurement(       value: 47,       unit: UnitEnergy.kilocalories      ).formatted(        .measurement(         width: .abbreviated,         usage: .workout,         numberFormat: .numeric(          precision: .fractionLength(0)         )        )       )     ) However when I try to use this code I get the following error. Value of type 'Measurement<UnitEnergy>' has no member 'formatted' Im using XCode Version 12.5.1 Any help is appreciated!
Replies
0
Boosts
0
Views
589
Activity
Aug ’21
How to read the wake-up alarm time into my app?
Hi all, Have anyone ran into the need to read/modify the iOS built-in Bedtimes setup? Could you point me to the documentation about how to read the Sleep or Wakeup alarm setting in Bedtime? Thank you, Will
Replies
0
Boosts
0
Views
642
Activity
Aug ’21
CareKit: Unable to adopt protocol 'OCKSurveyTaskViewControllerDelegate'
Hello all, this could surely be a newbie mistake but I'm unable to adopt this protocol to my class object I've created in a new project. The Error: "Cannot find type 'OCKSurveyTaskViewControllerDelegate' in scope" import CareKit import CareKitUI import CareKitStore import ResearchKit import UIKit import os.log final class CareFeedViewController: OCKDailyPageViewController, OCKTaskSurveyViewControllerDelegate { } However, I've been able to locate the 'OCKSurveyViewController.swift" file in the CareKit framework from SPM which has the protocol defined there, but I'm still unable to utilize it. Was the protocol only for demonstration purposes and not for use outside of the WWDC21 - CareKit Code Along?
Replies
1
Boosts
0
Views
1.4k
Activity
Jul ’23
Access to SpO2, EDA, ECG, and temperature?
I'm a researcher working for children with special needs such as ADHD. With my research group, we would like to use the Apple Smartwatch as a monitoring device in several health-related research projects. However, before buying a lot of devices, I need clear and detailed information about the accessibility of SpO2, EDA, ECG, and temperature raw data through the Apple watch. Will I be able to access raw data to embed in my customised app? If I need to develop an app that reads and processes through custom algorithms raw data coming from these sensors, is it possible? I just want clear and detailed information before buying a lot of devices.
Replies
1
Boosts
0
Views
1.2k
Activity
Sep ’21
Workout Distance summary is in miles. Can I make it meters?
Hello everyone, I'm making an app that saves rowing workouts. Rowing workouts are traditionally in meters. I want my workout summaries to always show in meters. I have created and saved a HKWorkout instance. For the totalDistance, I am saving a quantity that uses HKUnit.meter() as its unit. Any intervals that I've associated with the workout are also saved with HKUnit.meter() as the unit. When I look at the Workout in the Health app, it shows the total distance in miles. All the intervals are in miles as well Is there a special piece of metadata that I need to add to my workout to hint to the Health app that I'd like to always see the summary using meters? How can I get my workout to always be shown in meters in the health app? Thank you for your advice, _ michael
Replies
2
Boosts
0
Views
784
Activity
Aug ’21
Can't listen trigger of multi HKObserverQuery
Hi, I coded  HKObserverQuery multi time for observing ecg, high heart rate event..etc but App observe one query. Can I set multi HKObserverQuery?
Replies
1
Boosts
0
Views
677
Activity
Sep ’21
Healthkit- Vital Signs Data Update Frequency
I know that heart rate is sent by HealthKit every 4 seconds. But what about other vital signs? Oxygen saturation, blood pressure, Glucose, respiratory rate and body temperature?
Replies
1
Boosts
0
Views
705
Activity
Sep ’21
stopDeviceMotionUpdates doesn't stop motion updates
I am new to Swift development. I am building my first WatchOS app that collects motion data. I am collecting motion data using startDeviceMotionUpdates with handler. However stopDeviceMotionUpdates doesn't stop the updates and handler goes in endless loop. class WatchMotionManager: ObservableObject {     let motion = CMMotionManager()     let queue = OperationQueue()     func startQueuedUpdates() {         motion.deviceMotionUpdateInterval = 1.0 / 50.0         motion.showsDeviceMovementDisplay = true         motion.startDeviceMotionUpdates(to: self.queue, withHandler: { (data, error) in                 if let motionData = data {                     //get data                  }         })     }          func stopQueuedUpdates() {     self.motion.stopDeviceMotionUpdates()     } }```
Replies
2
Boosts
0
Views
726
Activity
Sep ’21
Provisioning profile contains attribute that triggers error
I recently renewed a provisioning profile and now i'm getting the following warning (and failure when building during code signing): warning: Provisioning profile "[redacted]" for "OneMedly" contains entitlements that aren't in the entitlements file: com.apple.developer.healthkit.background-delivery. To use these entitlements, add them to your entitlements file. Otherwise, remove unused entitlements from your provisioning profile. (in target 'OneMedly' from project 'OneMedly') The app does use HealthKit and the provisioning profile (which apple generates) has HealthKit and if I inspect the provisioning profile, it does indeed contain this healthkit.background-delivery attribute. This doesn't seem to be problem for debug builds, only for release builds. Does anyone know what is causing this warning/error? Is there a workaround?
Replies
2
Boosts
0
Views
2.1k
Activity
Sep ’21
SwiftUI render wrong size on old devices like Apple Watch Series 4
Problem: SwiftUI render wrong size on old device like Apple Watch Series 4. The height was be cut, not well render as series 6 or simulator. Check the screenshots. BTW: But it works well both on watch series 6 real device or simulator. Reproduce: Download “Build a Workout App for Apple Watch”, run the code on a real device of watch series 4 https://developer.apple.com/videos/play/wwdc2021/10009/ On Watch4-44 mm (first line be clip) On Simulator or watch 6.
Replies
0
Boosts
0
Views
1k
Activity
Sep ’21
How to fetch Lab Name and Lab Result Panel from Health Kit
Hello Team, We are Testing Health Records feature into our Patient Application. We have imported sample data available in Simulator and modelling it using FHIR Model. We are trying to group test results based on Origin(Lab Name and Result Date) of Lab Reports. But we are not able to retrieve Lab Name and Lab Test Panel Mapping information.
Replies
3
Boosts
0
Views
746
Activity
Sep ’21
researchkit data
Hi Can someone help me find a tutorial of how to access user data in a research kit app or set up a server to collect and manage data?
Replies
1
Boosts
0
Views
910
Activity
Feb ’22
How to read sleep duration goal and sleep schedule
Hello everyone, I am in the process of building an app that gives the user more statistical information about their sleep, and I would like to access the sleep duration goal and the sleep schedule that the user can set in the Health app. Is it possible to access this information and if so, how do I do that? You are welcome to point me to the specific documentation, I just can't find anything about this in the documentation. Have a nice day, Simon
Replies
1
Boosts
0
Views
1.1k
Activity
Sep ’21
Apple fitness app
Can you add sauna to the fitness activities?
Replies
2
Boosts
0
Views
719
Activity
Sep ’21
Issue testing the 'Verifiable Health Records' sample code
Hello, The new iOS 15 'Verifiable Health Records' sample code has an issue when I tap on the 'Request Samples' button: The call to HKVerifiableClinicalRecordQuery in ContentView.swift:63 comes back with an error: "Missing required entitlement identifier: verifiable-health-records" But it's unclear to me where I need to add this entitlement? In the Target , the HealthKit Capability is added with 'Clinical Health Records' selected. Is that not enough? I also added "Privacy - Health Records Usage Description" in the Info.plist, but that didn't resolve it. Thanks, Eiman
Replies
2
Boosts
0
Views
725
Activity
Oct ’21
Save Arm Movement
Hi, I'd like to create a gym app for apple watch. Is there any way to record the movements of the arms, so that apple watch knows when the movement has been made? Thanks Alberto
Replies
0
Boosts
0
Views
488
Activity
Oct ’21
HKSwimmingStrokeStyle in Fitness app
If I use the Apple training app for indoor swim workouts, I can see the distance by each swimming stroke style later in the Fitness app. However, if I build my own swim app, the distance by stroke style is not listed. What do I have to add, to have it listed there? The information are saved correct in the HKWorkoutEvent array in the workout.
Replies
1
Boosts
0
Views
1.4k
Activity
Dec ’21
How to add sample active energy to statistics when I use activity type other
Hello, i set up a watchOS app. I calculated the active burned energy by myself and add it every second as sample to the running workout builder. When I setup the statistics it sum up the app related burned energy for three times. Then the watchOS send active energy with 0. The samples are stored in the workout session but the total energy is 0. In the documentation apple wrote that if you use other you have to tell the system that the samples have to sum up. How I can do that?
Replies
0
Boosts
0
Views
412
Activity
Oct ’21
Fitnes awards after iphone change
Hello, I bought a new iphone (13) and after the change I can see all my old activity, trends ect. but I don’t have any awards now. I lost all of them. How can I get them again?
Replies
0
Boosts
0
Views
364
Activity
Oct ’21
HealthKit finishRoute not connecting workout and route.
When using the code below, I can see both a workout and a workout route within the Apple Health app on simulator, however the two are not connected. On my iPhone 12 mini, I notice similar with workout data from the Strava app. whereas a workout recorded with the Apple Watch Fitness app, will have a workout with a related route. // Save workout to Health store builder.finishWorkout { theWorkout, error in     // Finish route     routeBuilder.finishRoute(with: theWorkout!, metadata: [:]) { workoutRoute, error in     } } Anyone else have this issue?
Replies
3
Boosts
1
Views
572
Activity
Nov ’21