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

Post

Replies

Boosts

Views

Activity

WatchOS Fall Detection Consequences
My team and I are working on an app for a private emergency helpline. Now as far as I understand the (sparse) API documentation for fall detection, given the appropriate entitlement, the following happens upon a detected fall: The Standard UI will be opened with the options to a) call SOS b) acknowledge the fall but state that you're fine though, c) deny the fall, and (implicitly after 60 seconds on inactivity) call SOS because you didn't react. All fall detection apps will then receive a bit of background time and get the func fallDetectionManager(CMFallDetectionManager, didDetect: CMFallDetectionEvent, completionHandler: () -> Void) called with the appropriate event value. Now that's all good and it sounds like the custom fall detection is additive to the standard system. But but why is there something like that in the entitlement request form sheet: For any emergency calling features that you do not provide, explain any mitigations you use to make sure the user receives emergency services support that’s as close as possible to what they’d receive had they placed an emergency call natively. This sounds like our app would rather be a drop-in to the standard SOS service ­– in contrast to being additive and also in contrast to what the API documentation infers. Am I misunderstanding something?
0
0
275
Sep ’24
Workouts, activity rings, samples and more not syncing across devices running iOS 18 RC and watchOS 11 RC
I noticed last night that workouts I have been recording on my main carry device running 17.6.x have not been syncing to my beta devices running iOS 18 RC, iPadOS 18 RC and watchOS 11 RC. All devices are using the same Apple Account and I have iCloud enabled for Health data. The iPad running the RC has the syncing enabled in Profile. Is anyone else experiencing health data not propagating to the 18.x devices? Some of data exists on all devices but not all. For good measure I left the device unlocked on the health app last night for a long period of time to let it do its thing. This morning the data still hadn't propagated. I disabled and reenabled the synchronization on my iPad having chosen to delete all samples when disabling it. Hopefully all of my data dating back to the first Apple Watch in 2014 restores. FWIW my data set according to iCloud settings my health dataset is just shy of 650 MB. FB15102443 - Health / HealthKit: Workouts, activity rings, sample data, and more not syncing via iCloud to 18 RC device
0
0
317
Sep ’24
Health Export not complete
Good evening, when I use the automatic export feature from my iPhone, it successfully exports data. When reading the Export.xml file it is dispayed completely, with about 3 mio lines. When I check the file I see, that a lot of data is missing. E.g. the iPhone dispays the heart rates for several exercises (from last year), which don't have any correspondence in the export.xml file. Current exercises have. I am a developer myself and parsed all files without any error. My iPhone has enough free space (200GB or so) and iCloud has more than a TB free. Internet is connected via 1GBit line, WLAN with 800MBit and everything runs smooth. I would like to get a COMPLETE export of all the health data, without having to write a program on my own to accomplish this. Thank you. /C
0
0
232
Aug ’24
Developer Build Icon not showing in Apple Fitness
I am building an app that sends workout data to Apple Fitness. During development I noticed that my App Icon does not show up in Apple Fitness and it's just a blank space. The Icon seems to show just fine in Apple Health but not in Apple Fitness. I did the same test with the production version of my app and I can see the production icon just fine in Apple Fitness. I am trying to find information about which app Apple Fitness uses since it seems to differ from the one Apple Health uses. ChatGPT seems to think that Apple Fitness uses the App Store Connect icon (which I have for my prod app but not my dev app), but I cannot seem to verify that assumption with any kind of documentation. Can I please get information about which icon specifically Apple Fitness uses when displaying third party app integration information?
0
0
236
Aug ’24
CMBatchedSensorManager referenced on a iOS 15 device
We have an app that takes data from the accelerometer of the iPhone and watchOS. Some updates ago we included the high-frequency accelerometer for the watchOS with the CMBatchedSensorManager framework. We didn't test our app on iOS 16 or 15 devices, where that framework is unavailable, because the update was just for watchOS. We refer to that class just on a shared class, and was wrapped with an #if os(watchOS) condition. In our iPhone app, we import the CoreMotion framework but CMBatchedSensorManager is not used. Now, when you run the app on a device with iOS 15 you find this issue: dyld[17071]: Symbol not found: (OBJC_CLASS$_CMBatchedSensorManager) Referenced from: '/private/var/containers/Bundle/Application/C3CC754F-1674-4CBD-AD83-93229DDCF38D/Spleeft.app/Spleeft' Expected in: '/System/Library/Frameworks/CoreMotion.framework/CoreMotion' We need a solution to keep running our app on devices with iOS 15.0
2
0
358
Aug ’24
Missing app icon in the Fitness app
My iOS app has a correctly configured HealthKit integration. It successfully delivers all samples and data to HealthKit. For every workout sent to HealthKit, I can see the duration, workout name, calories, and other details. However, the app icon is missing. My project uses the Single Size setting for the app icon in the XCAssets folder. The app is available in the App Store in some regions. What can I do to fix this issue? The problem persists regardless of whether the device is running iOS 17 or 18.
3
1
401
Aug ’24
watchOS 11 beta 5 - Problem workout duration wrong on automatically appearing widget
On watchOS 11 when starting a workout session a widget appears automatically on the smart stack showing the pause or resume button. It´s a great feature, but my problem is that the duration is not showed correctly because the prepare phase of the workout and the pause / resume events are not taken into account calculating the duration. In my project I don´t use the workout builder. I have made a sample project with workout builder and there the duration is shown correctly. It would be great if this automatically appearing widget would also show the time correctly in case the workout builder is not used (prepare phase and pause resume events considered, otherwise it looks like a bug). Is there any way to opt out of this automatically appearing widget or could this be fixed? Any comments from an Apple engineer on this?
1
0
399
Aug ’24
Health app iOS 18 Public Beta: Can't record Sleep Process with iPhone only (without wearable)
Hello! My sleep process isn't recorded with iPhone only (without wearable device) on iOS 18. On previous iOS versions it was recorded but now it doesn't work. I compare iOS 17 and iOS 18 Beta and I see the difference that in Full Schedule was deleted tumbler "Track Time in Bed with iPhone" that helped to track sleep process without wearable device (I found it here: Health app -> Browse -> Sleep -> Your schedule block and tap on "Full Schedule & Options" -> Scroll to the bottom). I didn't find any information from Apple about this changes in change log. And one more time: I don't use Apple Watch or any wearable device. Do you have any information about sleep tracking with iPhone only? Can I track sleep process only with iPhone?
0
1
723
Aug ’24
Hi everyone,I'm developing a visionOS app using SwiftUI and RealityKit. I'm facing a challenge with fetching step data from HealthKit.
I have integrated HealthKit into my app to track and display step data. On my iPhone, the step data syncs and shows up immediately. However, when I try to fetch and display this data on my Vision Pro app, there's a noticeable delay before the data appears, even though I've given the necessary permissions and synced data through iCloud. Memory updated Here is your question in a similar format: Hi everyone, I'm developing a visionOS app using SwiftUI and RealityKit. I'm facing a challenge with fetching step data from HealthKit. Scenario: I have integrated HealthKit into my app to track and display step data. On my iPhone, the step data syncs and shows up immediately. However, when I try to fetch and display this data on my Vision Pro app, there's a noticeable delay before the data appears, even though I've given the necessary permissions and synced data through iCloud. Question: Why is there a delay in fetching step data from HealthKit on my Vision Pro app, and how can I reduce this delay to ensure real-time data display? Additional Information: I'm using HKStatisticsQuery to fetch the step data for the current day. The authorization for HealthKit is requested successfully. The data shows up after some time, but the initial delay is causing a poor user experience. Here is the relevant code snippet for fetching today's steps: class HealthManager: ObservableObject { let healthStore = HKHealthStore() @Published var activities: [String: Activity] = [:] init() { let steps = HKQuantityType(.stepCount) let healthTypes: Set = [steps] Task { do { try await healthStore.requestAuthorization(toShare: [], read: healthTypes) } catch { print("error fetching health data") } } } func fetchTodaySteps() { let steps = HKQuantityType(.stepCount) let predicate = HKQuery.predicateForSamples(withStart: .startOfDay, end: Date()) let query = HKStatisticsQuery(quantityType: steps, quantitySamplePredicate: predicate) { _, result, error in guard let quantity = result?.sumQuantity(), error == nil else { print("error fetching today's step data") return } let stepCount = quantity.doubleValue(for: .count()) print("stepCount \(stepCount)") } healthStore.execute(query) } } I'm open to alternative approaches if this method isn't the most efficient for real-time data fetching. Thanks in advance for any insights or suggestions! Best, Siddharth
3
0
586
Aug ’24
Can my iOS app access live cycling workout session data from the workouts app on the apple watch
Hello, I am trying to build a features where I want to monitor a user's biking workout session metrics like the current speed, average speed and distance travelled. I want to get these metrics as the user is actively doing a workout session in the Workouts app of the apple watch. Is it possible? Or it is not possible to get data from an active workout session from the workouts app.
0
0
330
Jul ’24
Linker errors when building with Xcode 15 and CocoaPods — building for iOS
** BUILD FAILED ** The following build commands failed: Ld /Users/siddesh/Library/Developer/Xcode/DerivedData/App-ddpkkzvberburtewkcvoihnirgjh/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/Logging.build/Objects-normal/x86_64/Binary/Logging normal x86_64 (in target 'Logging' from project 'Pods') (1 failure) Testing with xcodebuild. -> mySDK_Staging (8.8.0) - WARN | attributes: Missing required attribute license. - WARN | license: Missing license type. - WARN | source: Git SSH URLs will NOT work for people behind firewalls configured to only allow HTTP, therefore HTTPS is preferred. - WARN | [iOS] license: Unable to find a license file - ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code. - NOTE | xcodebuild: note: Using codesigning identity override: - - NOTE | [iOS] xcodebuild: note: Building targets in dependency order - NOTE | [iOS] xcodebuild: note: Target dependency graph (20 targets)
0
0
261
Jul ’24
Linker errors when building with Xcode 12 and CocoaPods — building for iOS
** BUILD FAILED ** The following build commands failed: Ld /Users/siddesh/Library/Developer/Xcode/DerivedData/App-ddpkkzvberburtewkcvoihnirgjh/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/Logging.build/Objects-normal/x86_64/Binary/Logging normal x86_64 (in target 'Logging' from project 'Pods') (1 failure) Testing with xcodebuild. -> mySDK_Staging (8.8.0) - WARN | attributes: Missing required attribute license. - WARN | license: Missing license type. - WARN | source: Git SSH URLs will NOT work for people behind firewalls configured to only allow HTTP, therefore HTTPS is preferred. - WARN | [iOS] license: Unable to find a license file - ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code. - NOTE | xcodebuild: note: Using codesigning identity override: - - NOTE | [iOS] xcodebuild: note: Building targets in dependency order - NOTE | [iOS] xcodebuild: note: Target dependency graph (20 targets)
0
0
247
Jul ’24
Xcode 15 and CocoaPods — building for iOS failed with Ld error
** BUILD FAILED ** The following build commands failed: Ld /Users/siddesh/Library/Developer/Xcode/DerivedData/App-ddpkkzvberburtewkcvoihnirgjh/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/Logging.build/Objects-normal/x86_64/Binary/Logging normal x86_64 (in target 'Logging' from project 'Pods') (1 failure) Testing with xcodebuild. -> mySDK_Staging (8.8.0) - WARN | attributes: Missing required attribute license. - WARN | license: Missing license type. - WARN | source: Git SSH URLs will NOT work for people behind firewalls configured to only allow HTTP, therefore HTTPS is preferred. - WARN | [iOS] license: Unable to find a license file - ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code. - NOTE | xcodebuild: note: Using codesigning identity override: - - NOTE | [iOS] xcodebuild: note: Building targets in dependency order - NOTE | [iOS] xcodebuild: note: Target dependency graph (20 targets)
0
0
254
Jul ’24
Resting Heart Rate - Individual readings?
I receive multiple resting heart rate readings throughout the day. I understand these readings are taken during the day while sedentary. However, if I query for: HKQuantityType.quantityType(forIdentifier: .restingHeartRate) I only receive ONE sample for the day, even though throughout the day multiple samples are observed. This is confirmed by looking at the Apple Health app and seeing only one recorded resting heart rate each day. Is there a way to get the individual resting heart rate readings for the .restingHeartRate type or am I stuck with querying the raw heart rate data for sedentary values (which don't always match Apples reported rhr)?
1
0
443
Jul ’24
Workout validation and Scheduler logic
Hey folks, a couple of questions regarding WorkoutKit: What happened to validation errors? They are mentioned in the WWDC23 video, but no longer are present in the API. It seems a fatal error is thrown if the workout fails validation (for example setting a negative distance in a workout goal). What is the logic of the WorkoutScheduler, if we try to add more workouts than is allowed? If the limit is 50, what happens when we try to add a 51st? Are workouts de-queued based on date or anything? API documentation is very sparse Do completed workouts and workouts with a scheduled date in the past stay in the WorkoutScheduler? Are we responsible for removing these? I guess my overall question regarding the WorkoutScheduler is, what are we responsible for managing and what is handled gracefully for us. None of these answers seem to be openly available, but if anyone know anecdotally or even better from the WorkoutKit team, I'd be very grateful! Thanks!
1
1
390
Jul ’24