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

HealthKit ID is the same with another Device
HealthKit tracker Id is the same with another Device, We are using an application to track our health progress and we are trying to connect our HealthKit to monitor our health data (steps and calories) but unfortunately we can't connect to the app (another application) at the same time because two devices is sharing just one health kit tracker ID. Can anyone help me to resolve this issue? Old phone was used by the other person before changing to new phone
1
0
213
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
325
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
321
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
467
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
257
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
273
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
212
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
204
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
213
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
306
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
313
Jul ’24
Scale app for coffee and small dishes
I just want to make my V60 coffee I found out that my electronic scale ran out of battery and there is no charger in my work location and I also work on a remote area nearest city about 100 km so, I grab my iPhone to find out is there any app can scale my coffee grams and water mills by putting coffee bin above the iPhone for measuring it’s weight. The answer is no, there are no apps for measuring weight of coffee bens and water droplets to make V60 coffee. Still I have made my coffee perfectly from my experience. I am writing this post just to have scale app at my iPhone and also if I can get some money it is good because no one can say no for the money
4
0
385
Jul ’24
Step Data Duplication Issue with Apple Health Integration
We are integrating Apple Health step data into our mobile application, Diyetkolik. However, we have received feedback from our users indicating that the step data appears to be significantly higher than expected. After conducting thorough research, we discovered that users who wear a smartwatch are experiencing step data duplication. Both the smartwatch and the phone's step data are being collected and combined, leading to inflated step counts in our application. We kindly request your assistance in addressing the following issues: How can we differentiate between step data from the smartwatch and the phone to avoid duplication? Are there best practices or specific APIs we should use to filter and manage step data more accurately? Can you provide guidance on how to implement a solution that ensures accurate step count data for users wearing multiple devices? We appreciate your support in resolving this matter to enhance the accuracy of our application and improve user experience.
1
0
384
Jul ’24
Watch not detecting stands
During WatchOS 10 dev betas and now into 11 dev betas, I am still seeing were stands are not being detected. What I do not know is if the steps are detected. But here is the situation. Today: I was going on some wiring outside and in the basement. I was clearly up and moving around for over an hour. I can see on my camera's I went outside at 15:50, came back in at 16:18. Then went to my basement and was working down there from 16:19 until 16:30. After that cleaned up my mess. So I was up and down stairs and without a doubt standing. At 16:50 I got the reminder to stand. Other cases: 1: I get home from work about XX:10 . I have to walk about 50 ft from my garage to my house, up stairs, take the dog out, make dinner, and finally get my chair to eat and at XX:50 I get the reminder. 2: I'm at work, I'm going to get lunch and I have to walk pretty far and again at XX:50 I get the reminder. This is very rare, but it has happened. Now, in a odd twist. I get up in the morning at XX:50, I have 10 steps to the bathroom, and I manage to get that hourly stand.
0
0
343
Jul ’24
Writing Workout Data into HealthKit
Hello, I am writing workout data into HealthKit using the HKWorkoutBuilder API for specific types of workouts (e.g. Cycling) in particular various time series data for power, speed, etc.. but I am unable to see the average values for these quantities on the workout summary page in the Apple Fitness app ? (I am only able to see the graph data in the show more / workout details) anything specific to be done in order to have the data shown in the main summary ?
1
0
377
Jul ’24
Apple Watch HealthKit Queries Beyond 7 Days?
This has long been a frustration of mine on Apple Watch, and I've brought it up at WWDC labs every year to no avail but while the limitation on the Apple Watch to only be able to query 7 days of HealthKit data may have made sense early in the AW's lifetime for battery preservation etc., it really no longer makes sense in modern AW development. Especially not with stand alone watch apps, as a developer I am prohibited from building the same experience on the Apple Watch that I can in an iPhone app. For example, my app looks at your current health metrics and compares them to your 60 day baseline to identify any deviations from your normal ranges. I cannot create the same experience on the watch using purely HealthKit queries, and am limited to using either iCloud or Watch Connectivity which have their own drawbacks and are not an option for a stand alone watch app. Can we finally expand the length of HealthKit queries the AW can make so that we can build the same powerful experience on the watch that we can on iPhone? Thank you! Gary See also Feedback FB7649612 (from April 2020).
1
0
520
Jun ’24