Post not yet marked as solved
I've noticed a bug in my app recently, it appears that in watchOS 8.5 (or earlier) that page layout is no longer initializing or awakingWithContext the pages beyond the first index.
According to the documentation:
In a page-based interface, all interface controllers are initialized up front but only the first one is displayed initially.
https://developer.apple.com/documentation/watchkit/wkinterfacecontroller/1619521-init
I am simply not seeing this happen anymore. I have logging in all of the lifecycle method of all three of my pages and the second and third controllers don't fire anything (including init) until I swipe to the right. This is when I would expect the willActivate and didActivate methods to be invoked. Instead I get init, awake, willActivate, and then didActivate. :/
This is unfortunate and a bug to the user because the second controller asks to becomeCurrent under some certain conditions that the first detects and fires via NotificationCenter. The automatic programatic switching between pages is totally broken.
FB9972047
Post not yet marked as solved
Hi! Ever since I set bedtime mode on my iPhone, it automatically turns on at night, which is great! However, is there a way that I can set my phone to automatically turn bedtime mode off at a specific time in the morning? Right now I have to manually switch it off every single morning. Thank you!
Post not yet marked as solved
Hello!
Today I worked for the first time with Apple Health Kit and successfully saved a workout in Health with the basic informations (activityType, start and end).
My app is in basic function an interval timer where you can create your own workout. Now in the next step I want to add the calories burned in the workout. This information is stored in the attribute 'totalEnergyBurned'.
Do I need to calculate this value myself or can I query this value directly if the user is wearing an Apple Watch? Or maybe the value is even automatically added to the workout if there is the corresponding record? (So far I have only tested the app in the simulator, which is why I can't answer this possibility).
My current code:
func saveToHealthKit(entryID: String){
if HKHealthStore.isHealthDataAvailable() {
let healthStore = HKHealthStore()
if(healthStore.authorizationStatus(for: HKObjectType.workoutType()) == .sharingAuthorized && healthStore.authorizationStatus(for: HKObjectType.quantityType(forIdentifier: HKQuantityTypeIdentifier.activeEnergyBurned)!) == .sharingAuthorized){
let newWorkout = HKWorkout(activityType: HKWorkoutActivityType.highIntensityIntervalTraining, start: entry.date!, end: Date())
healthStore.save(newWorkout) { success, error in
guard success else {
// Perform proper error handling here.
return
}
// Add detail samples here.
}
}
}
}
}
Thanks :)
Post not yet marked as solved
I have a problem with Apple HealthKit authorization. Everything worked fine until update of Xcode to version 13.3. It seems that that request for authorization is not fired, even when I explicitly declared that I want to request authorization onAppear of ContentView. This is code for ContentView:
import SwiftUI
struct ContentView: View {
@EnvironmentObject var firebaseManager: FirebaseManager
@EnvironmentObject var healthkitManager: HealthKitManager
var body: some View {
NavigationView {
if firebaseManager.signedIn {
HomePageView()
} else {
SignInView()
}
}
.onAppear {
healthkitManager.authorizeHealthKit()
firebaseManager.signedIn = firebaseManager.isSignedIn }
}
}
Function in HealthKitManager looks like this:
func authorizeHealthKit() {
//Check to see if HealthKit Is Available on this device
guard HKHealthStore.isHealthDataAvailable() else {
print("HealthKit data not available on this device")
return
}
// Set types to read and write in HealthStore
let typesToRead: Set = [
HKObjectType.characteristicType(forIdentifier: .dateOfBirth)!,
HKObjectType.quantityType(forIdentifier: .bloodGlucose)!,
HKObjectType.quantityType(forIdentifier: .insulinDelivery)!,
HKObjectType.quantityType(forIdentifier: .dietaryCarbohydrates)!,
HKObjectType.quantityType(forIdentifier: .stepCount)!,
HKObjectType.quantityType(forIdentifier: .heartRate)!,
HKObjectType.quantityType(forIdentifier: .appleExerciseTime)!,
]
let typesToWrite: Set = [
HKObjectType.quantityType(forIdentifier: .bloodGlucose)!,
HKObjectType.quantityType(forIdentifier: .insulinDelivery)!,
HKObjectType.quantityType(forIdentifier: .dietaryCarbohydrates)!,
]
// Request authorization for those quantity types.
healthStore.requestAuthorization(toShare: typesToWrite, read: typesToRead) { (success, error) in }
}
I've tried to add key Privacy - Health Update Usage Description and Privacy - Health Share Usage Description with some string values to Info tab in project file, but still nothing. When I build application, I get this in console:
[auth] FAILED prompting authorization request to share (
HKQuantityTypeIdentifierBloodGlucose,
HKQuantityTypeIdentifierDietaryCarbohydrates,
HKQuantityTypeIdentifierInsulinDelivery
), read (
HKCharacteristicTypeIdentifierDateOfBirth,
HKQuantityTypeIdentifierHeartRate,
HKQuantityTypeIdentifierBloodGlucose,
HKQuantityTypeIdentifierInsulinDelivery,
HKQuantityTypeIdentifierDietaryCarbohydrates,
HKQuantityTypeIdentifierAppleExerciseTime,
HKQuantityTypeIdentifierStepCount
)
I read some articles, tried multiple possible solutions, restarted my Mac, but everything without success. Should there be a problem because I have two environment object? I'll be thankful for any ideas...
Post not yet marked as solved
Can Apple Watch provide complete data on the heartbeat for thousands of seconds during the workout or when using the "Breathe" app?
When I exported data from Apple Health it shows the following data. The rows 195, 196 & 197 are measurements taken through the "Breathe" app.
Thank you for your answers,
Post not yet marked as solved
I want to detect when the user has removed the watch from wrist in the middle of a work out. in iOS devices using the HealthKit framework. Been checking the docs, no luck so far.
HealthKit
Post not yet marked as solved
hi is or does anyone want to team up with a group of nurses and doctors to build apps
Post not yet marked as solved
Wouldn’t it be dope to track your reading same way you can track your relaxation in your watch os but instead you get achievements for increasing your study times? Remove the 5 minute limitation, is anything help college students and all students alike follow a custom study pattern for example : I would like to study about 8 hours this week the watch can help me best fit it in my schedule keep track of my time when i am reading or studying and then give me dope achievements for doing so and even credit for your apple reads store so I can buy a book or two. Make studying fun, include me in this plan I’m down if your down I’m having with this because i believe its a great idea. ( jk ik you’re not obligated to include me in anything ).
Post not yet marked as solved
Hello,
I have problem with submision from App Store
I use to activity ring in Watch extension in my App.
I use activity rings to plot the values that the application has, but my application is not primarily intended for fitness. I enter my values that are obtained from the application in Iphone into the rings activity.
how can I use activity rings to allow the app store to upload the app? can I use activitity rings without health kit?
Issue with submission
Guideline 2.5.1 - Performance - Software Requirements
We noticed that your app uses HealthKit, but your app does not appear to include any primary features that require health or fitness data.
The intended use of HealthKit is generally to share health or fitness data with other apps or devices as a part of the app's core functionality.
Next Steps
To resolve this issue, please remove any HealthKit functionality from your app, as well as any references to this app’s interactivity with HealthKit from the app or its metadata. This includes removing any HealthKit-related keys in your app's Info.plist as well as removing any calls to HealthKit APIs, including those from 3rd party platforms, from your app.
Post not yet marked as solved
Our app supports SmartCardHealth and Apple Wallet-Health integration. We have seen an issue, when we try to add vaccine records with same Vaccine dose details of different users, the wallet app is taking the first one only the later one got automatically replaced by first showing the message "The Vaccination records already added" in Health app. Please help in resolving this issue, whether if have missed out any parameter in minified JSON response. Below are the response for our test records
{"resource":{"vaccineCode":{"coding":[{"system":http://hl7.org/fhir/sid/cvx,"code":"208"}]},"status":"completed","resourceType":"Immunization","performer":[{"actor":{"display":"TESTING PREPMOD"}}],"patient":{"reference":"resource:0"},"occurrenceDateTime":"2022-01-23","lotNumber":"TESTAUTOMATIONLOTNUMBER_D"},"fullUrl":"resource:1"}]}}},"nbf":1643984735,"iss":https://health.ri.gov/sh.cards/test}
{"resource":{"vaccineCode":{"coding":[{"system":http://hl7.org/fhir/sid/cvx,"code":"208"}]},"status":"completed","resourceType":"Immunization","performer":[{"actor":{"display":"TESTING PREPMOD"}}],"patient":{"reference":"resource:0"},"occurrenceDateTime":"2022-01-23","lotNumber":"TESTAUTOMATIONLOTNUMBER_D"},"fullUrl":"resource:1"}]}}},"nbf":1643984914,"iss":https://health.ri.gov/sh.cards/test}
Post not yet marked as solved
To whom it may concern,
After reviewing the documents, we realized that SensorKit is available only for the research study. I'm writing this email to ask two questions regarding the purpose of Sensorkit.
First, Are you planning to open the Sensorkit for regular apps with a focus on health and wellness or it's going to be limited to only Research?
Second, if it's going to be limited to only research, then what would be the goal of the app/research if we can't provide to everyone and scale the business (of course with user permission and consent)?
I appreciate your time in advance and looking forward to hearing from you.
Thanks,
Mohsen
Post not yet marked as solved
How do I remove a step data source in the Health app? Some of the devices are out of use now and I'd like to remove them from my Health data, but now it seems I can only drag them to the bottom in the priority list but am not able to remove them completely.
Post not yet marked as solved
Hi,
I am writing workout app for WatchOS and want to add activeEnergyBurned sample whenever user has finished exercise in workout.
But whenever I add sample to builder it returns that it was successfully added but when checking added samples in Health app, it shows that it is always 0 and also sum of samples is also always 0.
Does activeEnergyBurned has some additional requirements because when tried to write basalEnergyBurned it successfully wrote given calories.
Writing sample here:
let energyBurnedType = HKObjectType.quantityType(forIdentifier: .activeEnergyBurned)
if energyBurnedType != nil {
let energyBurned = HKQuantity(unit: HKUnit.largeCalorie(), doubleValue: Double(totalCalories))
let energyBurnedSample = HKQuantitySample(type: energyBurnedType!, quantity: energyBurned, start: self.exerciseStart, end: Date())
builder.add([energyBurnedSample]) { (success, error) in
print(success)
print(error)
}
}
And reading data that always returns 0:
func updateForStatistics(_ statistics: HKStatistics?) {
guard let statistics = statistics else { return }
DispatchQueue.main.async {
switch statistics.quantityType {
case HKQuantityType.quantityType(forIdentifier: .activeEnergyBurned):
let energyUnit = HKUnit.largeCalorie()
let value = statistics.sumQuantity()?.doubleValue(for: energyUnit)
self.activeCalories = Double( round( 1 * value! ) / 1 )
print(value)
return
default:
return
}
}
}
Any ideas on what am I missing?
I checked my workout recordings and I see that samples get added but doesn't affect total active energy shown in Health app:
And here you can see that sample is added:
Hello,
I am wondering whether a 3rd party application (which i wish to develop) can request information, such as heart rate, from the apple watch. I wish for my app to have heart rate, as an input. Is this possible?
kind regards
Post not yet marked as solved
I can able to get my health data list from health kit. I used below code to get my today's step count :
`func getTodaysSteps(completion: @escaping (Double) -> Void) {
let stepsQuantityType = HKQuantityType.quantityType(forIdentifier: .stepCount)!
let now = Date()
let startOfDay = Calendar.current.startOfDay(for: now)
let predicate = HKQuery.predicateForSamples(
withStart: startOfDay,
end: now,
options: .strictStartDate
)
let query = HKStatisticsQuery(
quantityType: stepsQuantityType,
quantitySamplePredicate: predicate,
options: .cumulativeSum
) { _, result, _ in
guard let result = result, let sum = result.sumQuantity() else {
completion(0.0)
return
}
completion(sum.doubleValue(for: HKUnit.count()))
}
healthStore.execute(query)
}`
But i have one more health data of my brother, where he invited me to see his health data in my real device. Now i was not able to read / get his health data. Is there any way to get that.
Any solution would be great ...!
Post not yet marked as solved
Point 27.4 of the App Store Review Guidelines reads:
"Apps may not use or disclose to third parties user data gathered from the HealthKit or CareKit APIs or from health-related human subject research for advertising or other use-based data mining purposes other than improving health, or for the purpose of health research"
Now, when the app will be ready for release I only intend to read the data and process it directly on the phone.
However, for the purpose of testing I need to extract the data, get it on some excel / csv file and analize it.
I initially thought to send the data to Firebase, but was told this might breach 27.4.
I only intend to have this feature in the beta I'll release on Test Flight for myself, but still Apple might refuse it.
What alternatives do I have?
Can I save the data locally on my watch? Might be quite heavy (monitoring up to 8 hours) How do I get it to a computer then?
Can I send the data to iCloud?
I won't be developing the app first hand, I'm hiring someone so I need to understand what is feasable.
Thank you for your help.
Post not yet marked as solved
May app is a health and wellness app giving tips on how to eat move and sleep better, fo weight loss and good health.
Apple say that for the app to be accepted that it needs to include citations. However this is a little vague.
For example a health app may include 100 different tips about working out; why strength training is better in some cases than cardio, why cardio can be good for mental health, how to sleep better, blue light blocking glasses, calorie deficit to lose weight etc. etc. etc.
If you need say two citations for each bit of advice, that would be 200 citations.
Looking at the other health apps out there, they don't include thorough citation or referencing.
Does anybody know what level of citation apple is looking for? Or how I could see an example. I've looked at other apps, but none of them seem to include any 'easy to find' citations.
Thanks in advance!
Post not yet marked as solved
So the documentation here only says:
A quantity sample type that measures the standard deviation of heartbeat intervals.
And below:
Discussion
These samples use time units (described in HKUnit) and measure discrete values (described in HKStatisticsQuery).
HealthKit calculates the Heart rate variability (HRV) by measuring the variation between individual heartbeats. While there are multiple ways of computing HRV, HealthKit uses SDNN heart rate variability, which uses the standard deviation of the inter-beat (RR) intervals between normal heartbeats (typically measured in milliseconds).
There is no details on how many heartbeat intervals are used to calculate the SDNN and how to modify it.
What if I want to calculate the SDNN on the last 30 intervals? Or the last 10? or the last 100? Or maybe I just want to calculate it on a timeframe, like 60 seconds, regardless of there were 50 or 120 heartbeats.
Post not yet marked as solved
Hello,
I am working on a healthcare app and want to integrate speech to text functionality in app. Before that, I wanted to make sure that the framework 'Speech', provided by Apple is HIPAA complaint. Please help me to know this.
Post not yet marked as solved
Hi,
I am a first time iOS developer, are there any regulations around what I need to develop on Apples HealthKit and use heart rate data in my app other than a privacy certificate and asking user permission?
Kind regards,
n00b