I bought my phone on April 1st week, 2024. In September battery was 96% cycle count 260. Now after 1 month battery health is 90% in cycle count 300. I am using my phone everyday4-5 hours and maitaining 20-80 charging. I didn't play any kind of games in my device. My question is why apple claim 1000 cycle count and 80% will be? And how to solve this issue?
Health & Fitness
RSS for tagExplore the technical aspects of health and fitness features, including sensor data acquisition, health data processing, and integration with the HealthKit framework.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hi everyone,
I am trying to send a request to my server in my watch application when HKObserverQuery is triggered. This is working fine when my app is in foreground however the request is not sending when the app manually terminated or in background. HKObserverQuery works fine and triggered in these cases however the request is not sending. I researched about URLSessionConfiguration.background and background sessions but I could not figure it out. I don't want to download or upload a file, I just want to send a simple request when HKObserverQuery is triggered.
Can you show me to a path way to make it possible?
I am trying to test my watch app with my iPhone, I am assuming the behavior of these scenarios might be same in both device, am I correct?
let urlsession = URLSession(configuration: URLSessionConfiguration.background(withIdentifier: "enablement"), delegate: self, delegateQueue: nil)
let dataTask = urlsession.dataTask(with: urlRequest)
dataTask.resume()
As shown in the code snippet, I tried to set background configuration to my URLSession.
I enabled background fetch in background modes.
Apple documentation says, dataTask can not run in background -> https://developer.apple.com/documentation/foundation/urlsessiontask However I don't want to perform a long running task such as downloading or uploading.
Hi,
In Apple Health, when there is an entry for a visit with a doctor, many times there are accompanying PDFs that are loaded into Apple Health along with the numerical/text data. Is there a way to pull PDFs into an app as well as the numerical/text data?
Thanks
Topic:
App & System Services
SubTopic:
Health & Fitness
Hello everyone,
I’m experiencing ongoing issues with my app’s review process. The app is being rejected under Guideline 1.4.1 (Safety - Physical Harm), and the reason provided is that it doesn’t include appropriate citations for health and medical recommendations.
This app is designed for qualified nutritionists to create personalized meal plans for clients. All recommendations are based on data provided by the client and supported by dietary guidelines from recognized organizations.
We’ve already included multiple citations to credible sources such as:
• USDA
• NIH
• WHO
• University of Oxford
• The Nutrition Source
• ResearchGate
• PubMed
• EUFIC
• DGE
• EFSA
These citations are clearly listed, and all recommendations come from nutritionists with degrees from accredited institutions. Despite this, the app continues to be rejected under 1.4.1. After asking the reviewer for clarification and providing detailed explanations, they’ve stopped responding and only send the same automated response referencing 1.4.1.
Additionally, the client profiles in our app are created via an Admin platform. Should data like height, weight, and other physical metrics be visible in the user’s profile to meet review requirements? We’re wondering if the lack of visible user metrics could be causing this rejection.
Has anyone experienced similar issues or have advice on how to resolve this? We’re uncertain what more we can do at this point and would appreciate any guidance.
Thanks in advance.
Topic:
App & System Services
SubTopic:
Health & Fitness
As the title says, I logged in to my simulator on my mac mini m2 and turned on icloud sync. My health data is in iCloud but it wont load in. When I go to documents for example I can see documents that I have loaded so I know something is working right. I have tried clicking Feature -> Trigger iCloud sync with no luck. The app I am building uses health data and there is no other way to get health data (heart rate, workouts, sleep) in the simulator. Please help
I'm currently trying to collect some of the following data whilst running a workout in a WatchOS app I'm building. Below are the data points I'm trying to retrieve:
HKQuantityType.init(.heartRate)
HKQuantityType.init(.oxygenSaturation)
HKQuantityType.init(.respiratoryRate)
HKQuantityType.init(.bloodPressureSystolic)
HKQuantityType.init(.bloodPressureDiastolic)
HKQuantityType.init(.heartRateVariabilitySDNN)
I'm using the following delegate function workoutBuilder(_:didCollectDataOf:) which is part of HKLiveWorkoutBuilderDelegate
Something I'm realising whilst running this on the simulator and on my Apple Watch is out of all of the Quantity types I'm requesting. Only the heart rate is being called via the delegate function when trying to retrieve the statistic.
Is this the intended behaviour of this API? Since there's no docs about what is and isn't exposed
Topic:
App & System Services
SubTopic:
Health & Fitness
Tags:
Health and Fitness
HealthKit
WorkoutKit
Hi,
My app reports daily step counts, and I’m trying to use HKCumulativeQuantitySample to report them to HealthKit by adding such objects with each update:
let sample = HKCumulativeQuantitySample(type: .stepCount, quantity: HKQuantity(unit: HKUnit.count(), doubleValue: dailyTotal), start: startOfDay, end: nowDate)
However, HealthKit interprets them as regular samples—it sums them into a global aggregate instead of updating the daily cumulative value. So if I report the daily step count as 500 and then 550, HealthKit interprets it as 1,050 steps instead of 550.
Is this expected behavior? If so, what is HKCumulativeQuantitySample intended for, and how should it be used? I’m struggling to find any examples.
Thank you
I am creating a watchOS app with XCode, and am experiencing an issue where workouts do not start on watchOS versions 9.6.3 and later.
・App specifications
Start workout when app starts
code (swift)
workout?.startActivity(with: Date())
·phenomenon
In watchOS version 9.6.3 or later, after the Apple Watch runs out of battery or is turned off.
When you turn on your Apple Watch and start using it, even if you start a workout (startActivity),The status may not change to running and the workout may not work.
*Workout always worked on watchOS versions earlier than version 9.6.3.
*The workout will work if you close the app and start the app again.
If anyone has any information, please provide it.
Topic:
App & System Services
SubTopic:
Health & Fitness
We are seeing an issue where sending data using the asynchronous method HKWorkoutSession.sendToRemoteWorkoutSession(data: Data) will never return in some cases (no success nor failure).
This issue is happening for roughly 5% of Workouts started and will stay broken for the whole workout. The other 95% of the workouts, the connection works flawlessly. This happens on both watchOS 10 and 11, and with phones running iOS 17 or 18. The issue is quite random and not reproducible.
Our app has thousands of workouts a day that use the workout session workout data send, with constant messages being send every few seconds.
In some of those 5% cases the "sendToRemoteWorkoutSession" will throw way later, like 30+ minutes later, if the watch app is awake long enough to capture a log of a failure.
Our code uses the same flow as in the sample project:
https://developer.apple.com/documentation/healthkit/workouts_and_activity_rings/building_a_multidevice_workout_app
Here is some sample code, which is pretty simple.
Setup code:
let workoutSession = try HKWorkoutSession(healthStore: healthStore, configuration: configuration)
workoutSession.delegate = self
activeWorkoutSession?.startMirroringToCompanionDevice { success, error in
print("Mirroring started on companion device: \(success), error: \(error)")
}
workoutSession?.prepare()
then later we send data using the workout session:
do {
print("Will send data")
try await workoutSession.sendToRemoteWorkoutSession(data: data)
print("Successfully sent data") // This nor the error may be called after waiting extensive amounts of time
} catch {
print("Failed to send data, error: \(error)") // This nor the success may be called after waiting extensive amounts of time
}
So far, the only fix is to restart the phone and watch at the same time, which is not a great user experience.
Is anyone else seeing this issue? or know how to fix this issue?
Topic:
App & System Services
SubTopic:
Health & Fitness
Tags:
Watch Connectivity
Health and Fitness
watchOS
WorkoutKit
When we upload workout data to HealthKit the route information with the workout detailed data is incomplete: just a few dots.
When we select "Show all workout routes" the route data for the same workout shows correctly.
We use the HKWorkoutBuilder to store the workout data, and add the location data with the HKWorkoutRouteBuilder to the workout with
Is this an Apple Health issue, or do we have to change something in the way we store the location data to the workout?
Topic:
App & System Services
SubTopic:
Health & Fitness
My Apple Watch after the beta update is not syncing the activities sometimes with Apple Health.
I just completed a 2.5 km walk, and it showed on Apple Health, yes, but it did not affect my daily goals. This is not the first time this has happened; this is just one of the examples that I'm sharing, other than what has been some problems that I am seeing after the beta update.
Additionally, the camera remote app is not working correctly as I cannot see anything on the watch screen like I used to.
For a given date, there are discrepancies between the step counts obtained from HealthKit and those displayed in the Health app. Is it possible for such discrepancies to occur even if step counts are not manually entered and multiple devices are not being used?
Hi guys,
In WWDC23 session 10016: Build custom workouts with WorkoutKit , the presenters mentioned that a Workout Plan can be exported to a JSON or binary file, and also showed a code snip:
let binaryRepresentation = try myCyclingWorkout.dataRepresentation(in: .compactBinary)
However in the current SDK, the property dataRepresentation can not be exported with a specific format, the base64EncodedString() result is unreadable.
Does anyone know how to export it as a JSON string now? Thanks very much.
I started with the custom workout example from Apple. I was able to load the apps from my mac (xcode) to my iphone. I can run the apps on my iphone. I completed the authorization and reviewed the workout. I then uploaded the workout to the watch and it appeared to work. It never showed up on the watch. I tried restarting the watch and iPhone. I have. a second watch and I tried that. Nothing helped. IPhone 14 with ios 18.2. Watch is Series 6 with watch OS 11.2. I also tried it with the watch on the charger but no change. Workout Kit seems like a good idea, but not if you cannot get it on your watch. It seems very few people are using it as there is little info online.
Topic:
App & System Services
SubTopic:
Health & Fitness
I'm encountering an issue with HealthKit permissions and would appreciate some guidance:
In my app's previous version, I granted write permissions for HKObjectType.workoutType() via the WatchKitExtension. Now, in the upcoming version, I'm trying to request read permissions for both HKObjectType.workoutType() and HKSeriesType.workoutRoute() via the iOS app.
However, after granting access:
The read permissions for Workout and Workout Route don't show up under Settings -> Health -> Data and Access -> [My App].
The Workout Route permission status remains notDetermined, even though I selected "Allow" when prompted.
Interestingly, if I request the same permissions via the WatchKitExtension, everything works as expected, and the issue doesn't occur.
Has anyone experienced a similar issue or have insights into why this might be happening? Could it be related to requesting permissions from the iOS app instead of the WatchKitExtension?
good morning every one, hopefully this is the right place where to speak.
I am not a developer and I am not familiar with and programming.
I am a simple apple user and happend to me that my diving watch died few weeks ago. Since then I am using Apple Watch Ultra to free dive and spare fishing.
Honestly we few small modifications this watch can take the lead over Garmin and Suunto that at the moment are the two best watch on the market for this specific area.
will it be possible to give some feedbacks and develop the app?
many Thanks
Mickey
Topic:
App & System Services
SubTopic:
Health & Fitness
As a user, there are times when I don't wear my sleep tracker to bed, but I nonetheless want to record my sleep times.
Apple Health supports this with the "Add Data" feature, but it's not possible to provide a time zone in the form.
Then as a developer, user-added sleep samples are missing time zone information.
I would expect that the time zone is requested within the Add Data form.
Without this information provided at input time, downstream applications are forced to infer the time zone ourselves, leading to potentially buggy or unintuitive behavior.
We have working code to fetch step data from HealthKit after requesting the necessary permissions. However, we’ve encountered an issue specific to one device, the iPhone 16 Pro Max. When querying the data, we do not receive a response, and the code enters an infinite loading state without completing the request.
The user who is facing this issue has tried logging in on another device, and it works fine. On the problematic device (iPhone 16 Pro Max), the request does not complete.
For reference, I’ve included the code below. Resolving this issue is crucial, so we would appreciate any guidance on what steps we can take to troubleshoot or resolve the problem on this specific device.
Please note that the device has granted permission to access HealthKit data.
static let healthStore = HKHealthStore()
static func limitReadFromHealthKitBetweenDates(fromDate: Date, toDate: Date = Date(), completion: @escaping ([HKStatistics]) -> Void) {
guard let stepsQuantityType = HKQuantityType.quantityType(forIdentifier: .stepCount) else { return }
let ignoreUserEntered = HKQuery.predicateForObjects(withMetadataKey: HKMetadataKeyWasUserEntered, operatorType: .notEqualTo, value: true)
let now = toDate
var interval = DateComponents()
interval.day = 1
var calendar = Calendar.current
calendar.locale = Locale(identifier: "en_US_POSIX")
var anchorComponents = calendar.dateComponents([.day, .month, .year], from: now)
anchorComponents.hour = 0
let anchorDate = calendar.date(from: anchorComponents) ?? Date()
let query = HKStatisticsCollectionQuery(quantityType: stepsQuantityType,
quantitySamplePredicate: ignoreUserEntered,
options: [.cumulativeSum],
anchorDate: anchorDate,
intervalComponents: interval)
query.initialResultsHandler = { _, results, error in
guard let results = results else {
print("Error returned from resultHandler: \(String(describing: error?.localizedDescription))")
return
}
print(results)
var statisticsArray: [HKStatistics] = []
results.enumerateStatistics(from: fromDate, to: now) { statistics, _ in
statisticsArray.append(statistics)
if statistics.endDate.getddmmyyyyslashGMT == now.getddmmyyyyslashGMT {
completion(statisticsArray)
}
}
}
healthStore.execute(query)
}
Please note that the code works on all devices except the problematic one. Could you please guide me on the next steps to resolve this issue?
Topic:
App & System Services
SubTopic:
Health & Fitness
Tags:
iOS
iPhone
Health and Fitness
HealthKit
I have a workout app which I am testing on device currently via TestFlight.
The generated workout (tennis and indoor) shows in the fitness app with correct HR and duration.
However, when I go to my Strava app, it does not show in the list of workouts for importing. (note, activities tracked using the regular tennis mode on the Apple Watch show fine)
I have also concurrently reached out to Strava support to see if there's anything they can offer support for.
However, does anybody here have any knowledge/experience of the requirement? Or whether this is a limitation of an application deployed via TestFlight?
I have a terrible feeling I am chasing ghosts, and it may be a TestFlight limitation for exporting workouts?
Thanks
Topic:
App & System Services
SubTopic:
Health & Fitness
Tags:
Health and Fitness
HealthKit
TestFlight
I want to use the Apple Healthkit data to recommend personalised insurance. Is this allowed? As I have read in the documentation that the Apple Healthkit data can only be used for fitness and health purposes. Anyone knows what is meant / scope of "fitness and health purposes"? Will personalised insurance as per health data be allowed under this category?