Health and Fitness

RSS for tag

Use HealthKit to enable your iOS and watchOS apps to work with the Apple Health app.

Posts under Health and Fitness tag

55 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

[WatchOS] Error while trying to insertRouteData into HKWorkoutRouteBuilder
I've ran into an error with the insertRouteData function of the HKWorkoutRouteBuilder that I can't seem to find any information on. The error is "Unable to find location series 1A193D3B-AFF5-41D8-A967-B1BE08D9F543 during data insert.". It seems to only happen when trying to insert very long routes, in the most recent case it was a 5 hour bike ride with 5900 samples. I save all the route data in a sqlite table as backup and after checking out the data there isn't any red flags as to why it would not insert correctly. Has anyone seen this before and could offer some insight or point me in the right direction to find the source of the error?
1
0
821
Oct ’23
Simulator Xcode - Import Swim Workout
Hi guys, I'm delveloping an app that use HealthData. I use this data: HKWorkoutType.workoutType(), HKObjectType.quantityType(forIdentifier: .heartRate)!, HKObjectType.quantityType(forIdentifier: .distanceSwimming)! I would like use Simulator to test app, but there aren't data. How can I import data? Now to test my app use only my iPhone, but in this way I don't test multiple device to test my app. Could you help me? Thank you. Filippo
0
0
421
Oct ’23
No swimming distances on watchOS 10
For some reason I am not receiving HKQuantityTypeIdentifierDistanceSwimming samples when using the watchOS 10 beta (8). The same code works fine on watchOS 9 but not on watchOS 10. I have tried specifically enabling them in the collection types for the live builder and /or starting a query for them, but neither approach is causing any samples to be returned to the app. Is this a known issue? Has something changed for swimming in watchOS 10? Thanks in advance.
4
0
967
Oct ’23
Long workout does not end when done from watch without iPhone.
When the build a multi-device workout app sample project is ran, there is a problem that stops workouts from being logged with only the watch. When the workout is started from the Apple Watch with the iPhone app closed, you can usually end the workout from the watch in the first few seconds. However, if the workout lasts more than 30 seconds, when the workout is ended via the watch, everything will stall for multiple minutes or indefinitely until the iPhone app is opened. How is it reccommended to fix this issue? It makes the sample project unusable for production as is because many users may want to sometimes log a workout with their watch without the iPhone present. I haven't been able to figure out a good solution, can someone please help with this.
1
0
471
Oct ’23
Minimum deployment Version for older WatchOSs and newer iOSs.
If a "Minimum Deployment Target" is updated to WatchOS7 on a product(iOS app with a companion watch app) that is already available on the App Store, watches running WatchOS6 will obviously no longer get updates. However, what is the experience for a user who has a WatchOS6 (maybe they own a Series 2) connected to an iPhone with iOS14? Will both the iPhone app and the Watch app stop getting updates? Will the Watch app stop getting updates, but the iPhone app continue receiving them and we have to manage this? Something else? Thanks in advance!
2
0
1.4k
Oct ’23
Trimming of activities allowed
At the moment I am working on a small app that retrieves Activities via HealthKit and allows user to trim activities. A typical use case would be when an user forgets to finish / stop an activity recording on his watch. Has anyone experience with submit such kind of apps to the app store. Does apple even allow this kind of feature? It could harm the integrity of health data if not done correctly.
0
0
393
Oct ’23
Can we use Apple Watch sensors all day long with no limit?
I'm student from Korea. I'm interested in apple things. I have several questions about Apple Watch sensors such as ECG(Electrocardiogram), Heart rate, Oxygen Saturation, breath rate, atrial fibrillation(afib) and so on. First of all, Can I use these sensors all day long? with no limit? I'm planning to develop some healthcare application using Apple Watch with sensors. I can't find examples of using sensors 24/7. And Second, If I can use the sensors all day long, can I execute the app in background? Finally, If I can execute the app in background, can I activate the sensors in background? Thank you for your help. I have tried searching developer guide, and searching the GitHub.
1
0
579
Sep ’23
How can I get the highest sample rate historical heart rate data from health store?
I am trying to get heart rate data from health store but when I make a query there are samples that come through with timestamps that shows that there are minutes that go by between the sample measurements. I remember watching an apple video where they were talking about the Quantity series and how these series have one kind of container for multiple data points of bpm data. I also see in the samples that there is a unit of " ___ counts per second" for each of the results so it would make sense if there were multiple datapoints within each of the results from the query but I don't know how to see what's inside of the results or if there is even anything more to them. This is the code I am using to retrieve the data: public func fetchLatestHeartRateSample(completion: @escaping (_ samples: [HKQuantitySample]?) -> Void) { /// Create sample type for the heart rate guard let sampleType = HKObjectType .quantityType(forIdentifier: .heartRate) else { completion(nil) return } /// Predicate for specifying start and end dates for the query let predicate = HKQuery .predicateForSamples( withStart: Date.distantPast, end: Date(), options: .strictEndDate) /// Set sorting by date. let sortDescriptor = NSSortDescriptor( key: HKSampleSortIdentifierStartDate, ascending: false) /// Create the query let query = HKSampleQuery( sampleType: sampleType, predicate: predicate, limit: Int(HKObjectQueryNoLimit), sortDescriptors: [sortDescriptor]) { ( _, results, error) in guard error == nil else { print("Error: \(error!.localizedDescription)") return } print(results ?? "Error printing results.") completion(results as? [HKQuantitySample]) } healthStore.execute(query) } Ultimately I want the most frequent heart rate data that is available. Ideally a bpm measurement every 5 - 10 seconds or less. Is this possible if I have not explicitly saved this heart rate data to the health store for a user before trying to access it or does Apple store all of this information in the health store regardless of the circumstances? Any help is greatly appreciated!
3
0
625
Sep ’23
How to get Apple Watch to send workout session data to my fitness app instantly
I am working with Apple HealthKit, and I need to add functionality to my app that allows a user's Apple Watch to automatically send the relevant data for their workout session (e.g. vo2 max, start timestamp, end timestamp, heartbeat, duration etc) as soon as they end their workout. This would need to work for any type of workout they do. E.g. if they are doing a running session, when they end their workout my app needs to receive the data for that running session almost instantly. I know that enableBackgroundDelivery allows my app to listen to changes in Apple Health in the background, but I'm not sure which method in HealthKit will allow me to implement the above use case. Does anyone have any pointers? I just want to know what methods in HealthKit will allow me to achieve this.
1
0
517
Sep ’23
watchOS 10 update has ruined GPS on Ultra during open water swimming.
Hi, I'm the developer of Open Water Swim, and I have had multiple reports and have also confirmed with my own testing that the WatchOS 10 update has seriously degraded GPS data during open water swimming, both with the native Workout app and with Open Water Swim. The data provided by CoreLocation is no longer accurate or trustworthy. I will post several pictures showing before and after update swims: Here's the raw data (mapped) of a swim done with watchOS 9 on the Ultra. Same swim today: From another pair of users: These two went TOGETHER, one with watchOS 9 and one with watchOS 10. You can probably guess which is which. Watch OS 9 swim: SAME SWIM WITH A PARTNER ON WATCHOS 10 (beta here) And another, again, two people swimming together, one watchOS 9 and one watchOS 10. watchOS 9 Same swim, same time, watchOS 10 I have filed two feedback assistant reports with APPLE. One when it was still a beta issue: FB12587468. This one has zero response from apple. And now a second one filed with watchOS 10 release: FB13192409 Apple devs, I know you're here and listening, so please let's get this fixed ASAP. Thanks
2
1
824
Sep ’23
How to make workouts with mixed activity-types (not swimBikeRun)?
Hey team! I have a question that feels very obvious, but I cannot seem to find the answer in the documentation. Using HealthKit/WorkoutKit, how you can make workouts with different activity types? Say you do 10 minutes of traditionalStrengthTraining followed by 10 minutes of running (common for crossfit and similar high intensity workout styles)? From the docs, it looks like you can’t change the activity type on an HKWorkout and the new dividing workouts into activities concept seems to only be for swimBikeRun workouts. Do you simply make multiple consecutive HKWorkoutSession instances, e.g doing startActivity -> beginCollection -> endCollection multiple times? Any input is highly appreciated!
0
2
376
Sep ’23
what is the best sign in option for healthcare app?
Dear developers, In case I want to start building healthcare marketplace app (pharmacies, medical equipments and labs) where every users can search for specific medicine, some Medical equipment and lab test can get a list of pharmacies, labs who provide those products/service. Having said that what could be the best sign in option for (pharmacists, labs, physicians, people/users) on phone number or E-mail or any sign in option that will fit who want to join healthcare app? I want your though guys here as I am trying to have a universal healthcare app that can connect all healthcare people/product/service with people. Thanks in advance for any advice
0
0
433
Sep ’23
WatchOS app with iOS app
I have an iOS phone educational sports app. There is one small section where the user can track their stats. It is a very minor part of the app (perhaps 1% of the app content). It would be perfect for a watchOS app on its own. Can I create a separate standalone watch app even when the content is included in my phone app when it is a very insignificant part of the iPhone app?
0
0
381
Sep ’23
Apple Health Kit
We have an app that reads data from the Apple Health Kit that is about 5 years old and we stopped receiving data from the app. While investigate why it quit working we are seeing some messages in the console log when we plug a phone into a mac that we are trying to get clarification on. We are seeing from the log: healthd 'STARTING: com.apple.healthkit.background-delivery.:<thread?>' followed by a: dasd 'COMPLETED com.apple.healthkit.background-delivery.:<thread?> at priority 30 then a dasd 'NO LONGER RUNNING com.apple.healthkit.background-delivery.:<thread?> ... Tasks running in the group [com.apple.dash.default] are 1! I was looking for some clarification on what these messages mean. Do they mean that our app was started and that the process completed successfully or, is it a warning saying that something abnormal happened. Also, I'm coming up short on documentation when I google for these messages. Is there a repository out there to help me make sense of what I'm seeing? Thanks for any insight!
0
0
398
Sep ’23
Would This Work? (Importing Medical Records)
So almost every EPIC customer is now at a version that would allow their medical records to be imported, many of them just haven't filled out the Apple form to list their organization. EPIC does publish a list of the FHIR endpoints for all of these customers though. Functionally it should be possible to write an app that authenticates the user to their provider, and downloads the FHIR data from the API, and then pushes it into Apple Health. The two things I'm not clear on though are: Are the Medical Records available to write to from an app, or is it only available through organizations registered through Apple using their UI? Would Apple consider this a replication of their functionality as far as App Store T's & C's go?
1
0
359
Aug ’23