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

56 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

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
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.3k
Jul ’23
[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
853
Oct ’23
The Watch App and iPhone App health care permissions are not synchronized.
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
6
0
1.9k
Nov ’23
Finishing a HKLiveWorkoutBuilder workout with lots of HKWorkoutActivity instances is very slow
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.
2
0
680
Apr ’24
Record workout on native WatchOS app in simulator
I'm trying to make a simple workout app that gets data from the health app (not an app that you use the record the actual workout). I can get data from the health app and manually add workouts but I couldn't find out how to record one with a map. Is there a way for me to either upload a GPX file for the workout, record it on the watch, or some other way to get the workout with a map on the simulator.
0
0
565
Jul ’23
Get workouts with map on apple watch simulator
Hi! I am trying to build a fitness app and running it on an iPhone simulator. So far, the app is working and can detect workouts and display them. Now, I want to make the app work for workouts that have a map but I couldn't find how to add a map or any other kind of data without recording it on the apple watch which I can't do because there is no workout app displayed on the simulated watch. Thanks.
0
0
458
Jul ’23
Problem with Sharing in Fitness app
Hello, I use iPhone 14 Pro with iOS 17 Beta, my girlfriend use iPhone 13 with newest iOS 16. We used to use Fitness application to share our daily activity (steps, kcals etc.) Unfortunately last time our activity progress doesn't shows properly. In my phone I have 1000 steps for example, my gf see 0 steps. The same was at I was on iOS 16. Removing and invitating again doesn't help. What can we check? Thanks in advance :)
0
0
361
Aug ’23
Creating a ECG sample programmatically via Apple Watch
I noticed that there was the ECG app on the Apple Watch that enabled you to gather an ECG sample. Was there any method that could programmatically enable tracking within your own watchOS application? Currently, the only way I can physically get samples is if I leave the application I'm building to physically start an ECG session through the ECG app which is not ideal.
1
0
437
Aug ’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
388
Aug ’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
677
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
430
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
401
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
459
Sep ’23