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

HKObserverQuery is not immediately call when using Apple Watch?
I created a HKObserverQuery for HKQuantityTypeIdentifierStepCount.If I add the count of steps walked wearing the Apple Watch, UpdateHandler of HKObserverQuery is not trigger immediately.While the app to the active state, UpdateHandler of HKObserverQuery is only called about 2 times per hour.Its timing is regularly. It seems the next call is just called after 30 minutes even if there is new data in the meantime.Strange things are ...When I changed my app to background state and to reactive, updateHandler of HKObserverQuery be called at its timing.In the case of a number of steps that have been registered in the iPhone is called updateHandler immediately.This issue occurs by the data of AppleWatch only.I tried to use timer instead of HKObserverQuery, but did not get the new changed data.Can I get latest data immediately without app to background?or is this bug?Please advise!
5
0
2.5k
Jul ’21
Meditation in Health
Hello, I am a meditator and am frustrated with the categorization that Apple provides in Health. It seems to me that there ought to be a category for meditation by itself, maybe with Tai Chi or other meditative activity. Putting it under Workouts misses the point. Thanks Eric
3
0
1.1k
Apr ’22
new ideas for Apple using solar power
Hi all i am a newbie and have no experience in this field but do have an idea that will help Apple in the 3rd world countries My idea is as follow (sorry for spelling)if you take the case of the phone and instead of just a coulor you put in a Solar cellpack then the pack can charge the phone while you are outside or inside and depending on how you design it power can be restored to the phone while outside . There is sturdy protection cases available for the phones and if apple brings a new phone out that has this feature in it then the world will wake up.Also no other phone will be so Green .Battry life will also be longer and the end user will benefit from it more .
2
0
988
Dec ’21
HealthKit thread crashes on nopl command after successfully running
I have a WatchKit app using HealthKit. When a view (with custom WKInterfaceController MonitorMetrics) appears it runs the following code: func startRecordingHeartRate(){ let heartRateSample = HKSampleType.quantityType(forIdentifier: HKQuantityTypeIdentifier.heartRate) let heartRateUnit = HKUnit.count().unitDivided(by: HKUnit.minute()) let datePredicate = HKQuery.predicateForSamples(withStart: Date(), end: nil, options: .strictStartDate) let anchor: HKQueryAnchor? = nil let updateHandler: (HKAnchoredObjectQuery, [HKSample]?, [HKDeletedObject]?, HKQueryAnchor?, Error?) -> () = { [unowned self] (query, newResult, deleted, newAnchor, error) in if let samples = newResult as? [HKQuantitySample] { guard samples.count > 0 else { return } for sample in samples { print("start of for loop") let doubleSample = sample.quantity.doubleValue(for: heartRateUnit) let timeSinceStart = sample.endDate.timeIntervalSince(self.startTime) heartData[0].append(doubleSample) heartData[1].append(Double(timeSinceStart)) self.delegate?.didRecieveHeartRate() } print("out of for loop") self.updateHeartRateLabel() } } let heartRateQuery = HKAnchoredObjectQuery(type: heartRateSample!, predicate: datePredicate, anchor: anchor, limit: Int(HKObjectQueryNoLimit), resultsHandler: updateHandler) heartRateQuery.updateHandler = updateHandler healthStore.execute(heartRateQuery) } func updateHeartRateLabel() { print("update label") let endIndex = heartData[0].endIndex let lastHeartRate = heartData[0][endIndex-1] self.heartRateLabel.setText(self.nf.string(from:NSNumber(value: lastHeartRate)) ?? "") }To pull heart rate data. Once it leaves this view it stops recording heart rate and resets the heartData arrays. When this view appears a second time it runs for one or two heart rates then crashes with a breakpoint on a nopl command in the HealthKit thread. (Since nopl is a no operation command I'm not sure how to interpret a crash there.)As part of my attempt at debugging I've been commenting out various parts of the code. If I comment out everything in the sample for-loop and self.updateHeartRateLabel() it works without error. If I then uncomment updateHeartRateLabel() it crashes like explained above. Now what is really strange is if I leave the call to updateHeartRateLabel() uncommented but comment out the entirety of the function so it is justfunc updateHeartRateLabel() { }The program still crashes. But once I comment the call back out it runs fine even though the call isn't doing anything it's still causing a crash. Now if I comment the call back out and uncomment the doubleSample declaration it works but uncommenting the timeSinceStart declaration causes the crash just like before. And the call to the delegate is also causing the crash.As far as I can tell when I bring the view into view the second time everything should be identical to how it was the first time it was ran. And it runs without problem the second time for one or two heart rate pulls before it crashes. Playing around with it it seems like startTime and delegate just disappear before it crashes. Calling:print(delegate)andprint(startTime)both cause the crash. And delegate is an optional but the print does not give nil it just crashes as if the variable name "delegate" no longer exists.
1
0
1.2k
Jun ’22
Research Kit survey options go off screen - scrolling feature?
This may not be the appropriate place to ask this but I'll give it a go:When presenting survey questions with more than 4 options, the options go off the screen and there doesn't seem to be a way to scroll on the simulator. I've milled through the documentation but I don't see any members for specifying scrolling? Any advice would be very much appreciated.
1
0
906
Jul ’22
Determining crash on HKObject _validateForCreation
While testing on device (Apple Watch) attempting to save an HKWorkout into HealthKit I am adding samples of distance samples, calories, heart rates and vo2Max to the workout. Unfortunately unlike this question I am not getting as detailed as a trace back...as far as I can tell it's crashing on adding a sample but I can't tell which sample it is or why?Code:private func addSamples(toWorkout workout: HKWorkout, from startDate: Date, to endDate: Date, handler: @escaping (Bool, Error?) -> Void) { let vo2MaxSample = HKQuantitySample(type: HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.vo2Max)!, quantity: vo2MaxQuantity(), start: startDate, end: endDate) var samples = [HKQuantitySample]() for distanceWalkingRunningSample in distanceWalkingRunningSamples { samples.append(distanceWalkingRunningSample) } for energySample in energySamples { samples.append(energySample) } samples.append(vo2MaxSample) samples.append(contentsOf: heartRateValues) // Add samples to workout healthStore.add(samples, to: workout) { (success: Bool, error: Error?) in if error != nil { print("Adding workout subsamples failed with error: \(String(describing: error))") handler(false, error) } if success { print("Success, samples have been added, workout Saved.") //WorkoutStartDate = \(workout.startDate) WorkoutEndDate = \(workout.endDate) handler(true, nil) } else { print("Adding workout subsamples failed no error reported") handler(false, nil) } } }Trace:Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Triggered by Thread: 0 Application Specific Information: abort() called Filtered syslog: None found Last Exception Backtrace: 0 CoreFoundation 0x1bdf75e8 __exceptionPreprocess + 124 1 libobjc.A.dylib 0x1b15717c objc_exception_throw + 33 2 CoreFoundation 0x1bdf752c +[NSException raise:format:] + 103 3 HealthKit 0x273dbdde -[HKObject _validateForCreation] + 111 4 HealthKit 0x273dbc48 +[HKObject _newDataObjectWithMetadata:device:config:] + 219 5 HealthKit 0x273dbb30 +[HKSample _newSampleWithType:startDate:endDate:device:metadata:config:] + 159 6 HealthKit 0x273e9ba8 +[HKWorkout _workoutWithActivityType:startDate:endDate:workoutEvents:duration:totalActiveEnergyBurned:totalBasalEnergyBurned:totalDistance:totalSwimmingStrokeCount:totalFlightsClimbed:goalType:goal:device:metadata:config:] + 431 7 HealthKit 0x274a9342 +[HKWorkout workoutWithActivityType:startDate:endDate:workoutEvents:totalEnergyBurned:totalDistance:device:metadata:] + 109 8 HealthKit 0x274a9160 +[HKWorkout workoutWithActivityType:startDate:endDate:workoutEvents:totalEnergyBurned:totalDistance:metadata:] + 87Thread 0 name: Dispatch queue: com.apple.main-threadThread 0 Crashed:0 libsystem_kernel.dylib 0x1b9e443c __pthread_kill + 81 libsystem_pthread.dylib 0x1baec270 pthread_kill$VARIANT$mp + 3342 libsystem_c.dylib 0x1b96d28e abort + 1063 libc++abi.dylib 0x1b136cfe __cxa_bad_cast + 04 libc++abi.dylib 0x1b136e8a default_unexpected_handler+ 16010 () + 05 libobjc.A.dylib 0x1b1573e0 _objc_terminate+ 29664 () + 1026 libc++abi.dylib 0x1b1493fc std::__terminate(void (*)+ 91132 ()) + 67 libc++abi.dylib 0x1b148ed6 __cxxabiv1::exception_cleanup_func+ 89814 (_Unwind_Reason_Code, _Unwind_Exception*) + 08 libobjc.A.dylib 0x1b157274 _objc_exception_destructor+ 29300 (void*) + 09 CoreFoundation 0x1bdf7530 -[NSException initWithCoder:] + 010 HealthKit 0x273dbde2 -[HKObject _validateForCreation] + 11611 HealthKit 0x273dbc4c +[HKObject _newDataObjectWithMetadata:device:config:] + 22412 HealthKit 0x273dbb34 +[HKSample _newSampleWithType:startDate:endDate:device:metadata:config:] + 16413 HealthKit 0x273e9bac +[HKWorkout _workoutWithActivityType:startDate:endDate:workoutEvents:duration:totalActiveEnergyBurned:totalBasalEnergyBurned:totalDistance:totalSwimmingStrokeCount:totalFlightsClimbed:goalType:goal:device:metadata:config:] + 43614 HealthKit 0x274a9346 +[HKWorkout workoutWithActivityType:startDate:endDate:workoutEvents:totalEnergyBurned:totalDistance:device:metadata:] + 11415 HealthKit 0x274a9164 +[HKWorkout workoutWithActivityType:startDate:endDate:workoutEvents:totalEnergyBurned:totalDistance:metadata:] + 92
3
0
2.1k
Apr ’22
SDK for SOS and HK Emergency Contacts
Hello,Extremely excited with the new health and SOS features being built into the Apple ecosystem. Keep up the great work Apple 🙂In order to extend the capabilities of these services, I'm interested in:Importing / Exporting emergency contacts from HealthkitExecute SOS signal from 3rd party applicationI took a dive into the Healthkit documentation and searched the forums, however, have not found anything pertaining to my use cases. Any help on this is greatly appreciated! HealthKit Data Types:https://developer.apple.com/documentation/healthkit/health_data_types?changes=_6
1
0
1.6k
Mar ’22
Why Apple Health app is an inactive data source?
I'm developing app based on Health Kit and after some time it stopped receiving completion blocks from HealthKit. In Health app it figures as inactive data source and is not listed in apps allowed to read data, despite permission to read it is switched on. Is there a way to fix that? Is it because of query limit, some app blacklisting?I couldn't find any documentation about this state.
3
0
3.7k
Sep ’22
HealthKit Error Code=3
I am currently receiving the following issue when my app requests access to the mindful minutes store:Error Domain=com.apple.healthkit Code=3 "Failed to look up source with bundle identifier "com.myorg.myapp"" UserInfo={NSLocalizedDescription=Failed to look up source with bundle identifier "com.myorg.myapp"}The app does not crash however the authentication page does not in fact display.This is strange because this was working perfectly in previous versions of my app (since which I have made very few alterations).The following is the code I am using to request the authentication:let typesToShare = Set([ HKObjectType.categoryType(forIdentifier: HKCategoryTypeIdentifier.mindfulSession)! ]) self.healthStore.requestAuthorization(toShare: typesToShare, read: nil) { (_, error) -> Void in if let error = error { print("\(error)") } DispatchQueue.main.async { self.performSegue(withIdentifier: "openWalkthroughThree", sender: self) } }Initially, I thought this was an issue with code signing. However, I have completely refreshed all my certificates and it still is not working.I would greatly appreciate a nudge in the right direction to solve this issue (specifically what the error actually is).
2
1
2.0k
Mar ’23
Broken Healthkit App - Unsupported Key
Evening,We had a previous app version developed in SWIFT and XCODE which utilizes the Apple Watch and healthkit. It was build last December and was working great. We dusted it off to do some updates and now we get a few errors. The one I think is causing it not to work is:App Store Connect Operation ErrorUnsupported Key. The Info.plist of bundle Awake.app/Watch/Heart Control WatchKit App.app/PlugIns/Heart Control WatchKit Extension.appex may not contain the UIRequiredDeviceCapabilities key.If we delete this ket in the Watchkit extensions the app fails to work on the watch. ANY help would be AWESOME! What has changed - google is being ineffective in solving this one.
1
0
743
Sep ’21
HealthKit event triggers each subscription
I'm trying to observe .irregularHeartRhythmEvent using HKObserverQuery. Code, I'm using to subscribe to this event: private func subscribeForAbnormals() { let abnormals = HKCategoryType.categoryType(forIdentifier: .irregularHeartRhythmEvent)! healthStore.enableBackgroundDelivery( for: abnormals, frequency: HKUpdateFrequency.immediate ) { isSuccess, error in let subscriptionStatus = isSuccess ? "OK ✅" : "FAILED ❌" print("Irregular hearbeat subscription status: \(subscriptionStatus)") if let error = error { print(error.localizedDescription) } } let query = HKObserverQuery( sampleType: abnormals, predicate: nil ) { [weak self] _, completionHandler, _ in print("Irregular hearbeat detected") completionHandler() } healthStore.execute(query) } Each time I call this function, I see output in my console: Irregular hearbeat subscription status: OK ✅ Irregular hearbeat detected According to HealthApp, I have no cases of Irregular Hearth Rhythm. Also, I havn't any options how to detect if triggered event is fake or not. Absolutely same situation with .lowHeartRateEvent and .highHeartRateEvent My app has all allowed accesses to HealthKit. How can I actually subscribe for such kind of events to track this and notify user?
2
0
960
Sep ’21
App Rejected 1.4 Safety: Physical Harm
FITPASS app is already on the App Store, but we were rejected during the last review. The app is available here - https://apps.apple.com/in/app/fitpass-gyms-fitness-pass/id1049745078 The reason from the review team is that - 4 Safety: Physical Harm 5 Performance: Software Requirements Guideline 1.4.1 - Safety - Physical Harm Your app provides health or medical recommendations, calculations, references, wellness reports, or diagnoses without including the sources of the recommendations. FITPASS only calculating customer BMI and RMR. We do not understand where is the problem and why the app was approved multiple times and now not. Can anyone help us to understand where can be a problem? please suggest someone
4
0
1.9k
Jan ’22
Extended Apple Watch Monitoring of Cardiac Arythmias
Will the Apple Watch at some point include cardiac monitoring for a “prolonged QT interval.” The cardiac QT interval is measurable on a standard medical office or hospital-adminstered EKG, but a prolonged interval, such as in Long QT Syndrome, is an aryhthmia that can trigger chaotic heartbeats, fainting, seizures, and in rare cases, sudden death.
1
1
2.3k
Oct ’22
HKObserverQuery is not immediately call when using Apple Watch?
I created a HKObserverQuery for HKQuantityTypeIdentifierStepCount.If I add the count of steps walked wearing the Apple Watch, UpdateHandler of HKObserverQuery is not trigger immediately.While the app to the active state, UpdateHandler of HKObserverQuery is only called about 2 times per hour.Its timing is regularly. It seems the next call is just called after 30 minutes even if there is new data in the meantime.Strange things are ...When I changed my app to background state and to reactive, updateHandler of HKObserverQuery be called at its timing.In the case of a number of steps that have been registered in the iPhone is called updateHandler immediately.This issue occurs by the data of AppleWatch only.I tried to use timer instead of HKObserverQuery, but did not get the new changed data.Can I get latest data immediately without app to background?or is this bug?Please advise!
Replies
5
Boosts
0
Views
2.5k
Activity
Jul ’21
Meditation in Health
Hello, I am a meditator and am frustrated with the categorization that Apple provides in Health. It seems to me that there ought to be a category for meditation by itself, maybe with Tai Chi or other meditative activity. Putting it under Workouts misses the point. Thanks Eric
Replies
3
Boosts
0
Views
1.1k
Activity
Apr ’22
new ideas for Apple using solar power
Hi all i am a newbie and have no experience in this field but do have an idea that will help Apple in the 3rd world countries My idea is as follow (sorry for spelling)if you take the case of the phone and instead of just a coulor you put in a Solar cellpack then the pack can charge the phone while you are outside or inside and depending on how you design it power can be restored to the phone while outside . There is sturdy protection cases available for the phones and if apple brings a new phone out that has this feature in it then the world will wake up.Also no other phone will be so Green .Battry life will also be longer and the end user will benefit from it more .
Replies
2
Boosts
0
Views
988
Activity
Dec ’21
Contact design team
I've designed a new IPhone. I would like to show it to the design team. Please help!
Replies
5
Boosts
0
Views
2.9k
Activity
Apr ’23
How to delete purgeable storage
Need help! How to you delete or overwight purgeable storage?
Replies
1
Boosts
0
Views
657
Activity
Oct ’21
HealthKit thread crashes on nopl command after successfully running
I have a WatchKit app using HealthKit. When a view (with custom WKInterfaceController MonitorMetrics) appears it runs the following code: func startRecordingHeartRate(){ let heartRateSample = HKSampleType.quantityType(forIdentifier: HKQuantityTypeIdentifier.heartRate) let heartRateUnit = HKUnit.count().unitDivided(by: HKUnit.minute()) let datePredicate = HKQuery.predicateForSamples(withStart: Date(), end: nil, options: .strictStartDate) let anchor: HKQueryAnchor? = nil let updateHandler: (HKAnchoredObjectQuery, [HKSample]?, [HKDeletedObject]?, HKQueryAnchor?, Error?) -> () = { [unowned self] (query, newResult, deleted, newAnchor, error) in if let samples = newResult as? [HKQuantitySample] { guard samples.count > 0 else { return } for sample in samples { print("start of for loop") let doubleSample = sample.quantity.doubleValue(for: heartRateUnit) let timeSinceStart = sample.endDate.timeIntervalSince(self.startTime) heartData[0].append(doubleSample) heartData[1].append(Double(timeSinceStart)) self.delegate?.didRecieveHeartRate() } print("out of for loop") self.updateHeartRateLabel() } } let heartRateQuery = HKAnchoredObjectQuery(type: heartRateSample!, predicate: datePredicate, anchor: anchor, limit: Int(HKObjectQueryNoLimit), resultsHandler: updateHandler) heartRateQuery.updateHandler = updateHandler healthStore.execute(heartRateQuery) } func updateHeartRateLabel() { print("update label") let endIndex = heartData[0].endIndex let lastHeartRate = heartData[0][endIndex-1] self.heartRateLabel.setText(self.nf.string(from:NSNumber(value: lastHeartRate)) ?? "") }To pull heart rate data. Once it leaves this view it stops recording heart rate and resets the heartData arrays. When this view appears a second time it runs for one or two heart rates then crashes with a breakpoint on a nopl command in the HealthKit thread. (Since nopl is a no operation command I'm not sure how to interpret a crash there.)As part of my attempt at debugging I've been commenting out various parts of the code. If I comment out everything in the sample for-loop and self.updateHeartRateLabel() it works without error. If I then uncomment updateHeartRateLabel() it crashes like explained above. Now what is really strange is if I leave the call to updateHeartRateLabel() uncommented but comment out the entirety of the function so it is justfunc updateHeartRateLabel() { }The program still crashes. But once I comment the call back out it runs fine even though the call isn't doing anything it's still causing a crash. Now if I comment the call back out and uncomment the doubleSample declaration it works but uncommenting the timeSinceStart declaration causes the crash just like before. And the call to the delegate is also causing the crash.As far as I can tell when I bring the view into view the second time everything should be identical to how it was the first time it was ran. And it runs without problem the second time for one or two heart rate pulls before it crashes. Playing around with it it seems like startTime and delegate just disappear before it crashes. Calling:print(delegate)andprint(startTime)both cause the crash. And delegate is an optional but the print does not give nil it just crashes as if the variable name "delegate" no longer exists.
Replies
1
Boosts
0
Views
1.2k
Activity
Jun ’22
Research Kit survey options go off screen - scrolling feature?
This may not be the appropriate place to ask this but I'll give it a go:When presenting survey questions with more than 4 options, the options go off the screen and there doesn't seem to be a way to scroll on the simulator. I've milled through the documentation but I don't see any members for specifying scrolling? Any advice would be very much appreciated.
Replies
1
Boosts
0
Views
906
Activity
Jul ’22
Determining crash on HKObject _validateForCreation
While testing on device (Apple Watch) attempting to save an HKWorkout into HealthKit I am adding samples of distance samples, calories, heart rates and vo2Max to the workout. Unfortunately unlike this question I am not getting as detailed as a trace back...as far as I can tell it's crashing on adding a sample but I can't tell which sample it is or why?Code:private func addSamples(toWorkout workout: HKWorkout, from startDate: Date, to endDate: Date, handler: @escaping (Bool, Error?) -> Void) { let vo2MaxSample = HKQuantitySample(type: HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.vo2Max)!, quantity: vo2MaxQuantity(), start: startDate, end: endDate) var samples = [HKQuantitySample]() for distanceWalkingRunningSample in distanceWalkingRunningSamples { samples.append(distanceWalkingRunningSample) } for energySample in energySamples { samples.append(energySample) } samples.append(vo2MaxSample) samples.append(contentsOf: heartRateValues) // Add samples to workout healthStore.add(samples, to: workout) { (success: Bool, error: Error?) in if error != nil { print("Adding workout subsamples failed with error: \(String(describing: error))") handler(false, error) } if success { print("Success, samples have been added, workout Saved.") //WorkoutStartDate = \(workout.startDate) WorkoutEndDate = \(workout.endDate) handler(true, nil) } else { print("Adding workout subsamples failed no error reported") handler(false, nil) } } }Trace:Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Triggered by Thread: 0 Application Specific Information: abort() called Filtered syslog: None found Last Exception Backtrace: 0 CoreFoundation 0x1bdf75e8 __exceptionPreprocess + 124 1 libobjc.A.dylib 0x1b15717c objc_exception_throw + 33 2 CoreFoundation 0x1bdf752c +[NSException raise:format:] + 103 3 HealthKit 0x273dbdde -[HKObject _validateForCreation] + 111 4 HealthKit 0x273dbc48 +[HKObject _newDataObjectWithMetadata:device:config:] + 219 5 HealthKit 0x273dbb30 +[HKSample _newSampleWithType:startDate:endDate:device:metadata:config:] + 159 6 HealthKit 0x273e9ba8 +[HKWorkout _workoutWithActivityType:startDate:endDate:workoutEvents:duration:totalActiveEnergyBurned:totalBasalEnergyBurned:totalDistance:totalSwimmingStrokeCount:totalFlightsClimbed:goalType:goal:device:metadata:config:] + 431 7 HealthKit 0x274a9342 +[HKWorkout workoutWithActivityType:startDate:endDate:workoutEvents:totalEnergyBurned:totalDistance:device:metadata:] + 109 8 HealthKit 0x274a9160 +[HKWorkout workoutWithActivityType:startDate:endDate:workoutEvents:totalEnergyBurned:totalDistance:metadata:] + 87Thread 0 name: Dispatch queue: com.apple.main-threadThread 0 Crashed:0 libsystem_kernel.dylib 0x1b9e443c __pthread_kill + 81 libsystem_pthread.dylib 0x1baec270 pthread_kill$VARIANT$mp + 3342 libsystem_c.dylib 0x1b96d28e abort + 1063 libc++abi.dylib 0x1b136cfe __cxa_bad_cast + 04 libc++abi.dylib 0x1b136e8a default_unexpected_handler+ 16010 () + 05 libobjc.A.dylib 0x1b1573e0 _objc_terminate+ 29664 () + 1026 libc++abi.dylib 0x1b1493fc std::__terminate(void (*)+ 91132 ()) + 67 libc++abi.dylib 0x1b148ed6 __cxxabiv1::exception_cleanup_func+ 89814 (_Unwind_Reason_Code, _Unwind_Exception*) + 08 libobjc.A.dylib 0x1b157274 _objc_exception_destructor+ 29300 (void*) + 09 CoreFoundation 0x1bdf7530 -[NSException initWithCoder:] + 010 HealthKit 0x273dbde2 -[HKObject _validateForCreation] + 11611 HealthKit 0x273dbc4c +[HKObject _newDataObjectWithMetadata:device:config:] + 22412 HealthKit 0x273dbb34 +[HKSample _newSampleWithType:startDate:endDate:device:metadata:config:] + 16413 HealthKit 0x273e9bac +[HKWorkout _workoutWithActivityType:startDate:endDate:workoutEvents:duration:totalActiveEnergyBurned:totalBasalEnergyBurned:totalDistance:totalSwimmingStrokeCount:totalFlightsClimbed:goalType:goal:device:metadata:config:] + 43614 HealthKit 0x274a9346 +[HKWorkout workoutWithActivityType:startDate:endDate:workoutEvents:totalEnergyBurned:totalDistance:device:metadata:] + 11415 HealthKit 0x274a9164 +[HKWorkout workoutWithActivityType:startDate:endDate:workoutEvents:totalEnergyBurned:totalDistance:metadata:] + 92
Replies
3
Boosts
0
Views
2.1k
Activity
Apr ’22
Add Hospitals to Health Records App
How do I add my hospital to the list of hospitals available on the Health Records on iPhone application?
Replies
1
Boosts
0
Views
778
Activity
Oct ’25
Open Health App Sources using URL Schemes
I used "x-apple-health://" to open up the health app, but I want to open the Health App Sources and my app, so that my users can find the healthkit authorizations for my app. I tried "x-apple-health://Sources/MyAppName/", but it did not work. Let me know what you think I can do. Thanks
Replies
4
Boosts
1
Views
5.5k
Activity
Jan ’23
SDK for SOS and HK Emergency Contacts
Hello,Extremely excited with the new health and SOS features being built into the Apple ecosystem. Keep up the great work Apple 🙂In order to extend the capabilities of these services, I'm interested in:Importing / Exporting emergency contacts from HealthkitExecute SOS signal from 3rd party applicationI took a dive into the Healthkit documentation and searched the forums, however, have not found anything pertaining to my use cases. Any help on this is greatly appreciated! HealthKit Data Types:https://developer.apple.com/documentation/healthkit/health_data_types?changes=_6
Replies
1
Boosts
0
Views
1.6k
Activity
Mar ’22
Why Apple Health app is an inactive data source?
I'm developing app based on Health Kit and after some time it stopped receiving completion blocks from HealthKit. In Health app it figures as inactive data source and is not listed in apps allowed to read data, despite permission to read it is switched on. Is there a way to fix that? Is it because of query limit, some app blacklisting?I couldn't find any documentation about this state.
Replies
3
Boosts
0
Views
3.7k
Activity
Sep ’22
How to access FHIR patient data in Healthkit
Hello,I am trying to access Patient name from Health Records, when I look at the Sample Location in iPhone Simulator, I see the patient FHIR data but somehow I am not able to find any documentation on how to access it? Please help
Replies
2
Boosts
0
Views
932
Activity
Aug ’21
HealthKit Error Code=3
I am currently receiving the following issue when my app requests access to the mindful minutes store:Error Domain=com.apple.healthkit Code=3 "Failed to look up source with bundle identifier "com.myorg.myapp"" UserInfo={NSLocalizedDescription=Failed to look up source with bundle identifier "com.myorg.myapp"}The app does not crash however the authentication page does not in fact display.This is strange because this was working perfectly in previous versions of my app (since which I have made very few alterations).The following is the code I am using to request the authentication:let typesToShare = Set([ HKObjectType.categoryType(forIdentifier: HKCategoryTypeIdentifier.mindfulSession)! ]) self.healthStore.requestAuthorization(toShare: typesToShare, read: nil) { (_, error) -> Void in if let error = error { print("\(error)") } DispatchQueue.main.async { self.performSegue(withIdentifier: "openWalkthroughThree", sender: self) } }Initially, I thought this was an issue with code signing. However, I have completely refreshed all my certificates and it still is not working.I would greatly appreciate a nudge in the right direction to solve this issue (specifically what the error actually is).
Replies
2
Boosts
1
Views
2.0k
Activity
Mar ’23
Broken Healthkit App - Unsupported Key
Evening,We had a previous app version developed in SWIFT and XCODE which utilizes the Apple Watch and healthkit. It was build last December and was working great. We dusted it off to do some updates and now we get a few errors. The one I think is causing it not to work is:App Store Connect Operation ErrorUnsupported Key. The Info.plist of bundle Awake.app/Watch/Heart Control WatchKit App.app/PlugIns/Heart Control WatchKit Extension.appex may not contain the UIRequiredDeviceCapabilities key.If we delete this ket in the Watchkit extensions the app fails to work on the watch. ANY help would be AWESOME! What has changed - google is being ineffective in solving this one.
Replies
1
Boosts
0
Views
743
Activity
Sep ’21
How to get beat-to-beat measurements's BPM
Using HKHeartbeatSeriesQuery, I am able to get beat-to-beat timestamps. How to get the BPM for those timestamps?I am able to see the BPM in apple health app.
Replies
1
Boosts
0
Views
1.1k
Activity
Mar ’22
HealthKit for iPadOS?
This might be a silly question. Does anyone know if HealthKit is available for iPadOS 14? I see that it is now available for MacCatalyst 13.0+ in the documentation but iPadOS was not listed. Thanks, Casey
Replies
3
Boosts
0
Views
2.2k
Activity
Jun ’23
HealthKit event triggers each subscription
I'm trying to observe .irregularHeartRhythmEvent using HKObserverQuery. Code, I'm using to subscribe to this event: private func subscribeForAbnormals() { let abnormals = HKCategoryType.categoryType(forIdentifier: .irregularHeartRhythmEvent)! healthStore.enableBackgroundDelivery( for: abnormals, frequency: HKUpdateFrequency.immediate ) { isSuccess, error in let subscriptionStatus = isSuccess ? "OK ✅" : "FAILED ❌" print("Irregular hearbeat subscription status: \(subscriptionStatus)") if let error = error { print(error.localizedDescription) } } let query = HKObserverQuery( sampleType: abnormals, predicate: nil ) { [weak self] _, completionHandler, _ in print("Irregular hearbeat detected") completionHandler() } healthStore.execute(query) } Each time I call this function, I see output in my console: Irregular hearbeat subscription status: OK ✅ Irregular hearbeat detected According to HealthApp, I have no cases of Irregular Hearth Rhythm. Also, I havn't any options how to detect if triggered event is fake or not. Absolutely same situation with .lowHeartRateEvent and .highHeartRateEvent My app has all allowed accesses to HealthKit. How can I actually subscribe for such kind of events to track this and notify user?
Replies
2
Boosts
0
Views
960
Activity
Sep ’21
App Rejected 1.4 Safety: Physical Harm
FITPASS app is already on the App Store, but we were rejected during the last review. The app is available here - https://apps.apple.com/in/app/fitpass-gyms-fitness-pass/id1049745078 The reason from the review team is that - 4 Safety: Physical Harm 5 Performance: Software Requirements Guideline 1.4.1 - Safety - Physical Harm Your app provides health or medical recommendations, calculations, references, wellness reports, or diagnoses without including the sources of the recommendations. FITPASS only calculating customer BMI and RMR. We do not understand where is the problem and why the app was approved multiple times and now not. Can anyone help us to understand where can be a problem? please suggest someone
Replies
4
Boosts
0
Views
1.9k
Activity
Jan ’22
Extended Apple Watch Monitoring of Cardiac Arythmias
Will the Apple Watch at some point include cardiac monitoring for a “prolonged QT interval.” The cardiac QT interval is measurable on a standard medical office or hospital-adminstered EKG, but a prolonged interval, such as in Long QT Syndrome, is an aryhthmia that can trigger chaotic heartbeats, fainting, seizures, and in rare cases, sudden death.
Replies
1
Boosts
1
Views
2.3k
Activity
Oct ’22