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

Workouts fail to register on Fitness activity rings
Hello, My app syncs workout data from a third-party device and records workouts with HealthKit as follows: let builder = HKWorkoutBuilder(healthStore: healthStore, configuration: hkConf, device: hkDevice) try await builder.beginCollection(at: startDate) try await builder.addSamples(samples) try await builder.endCollection(at: endDate) let workout = try await builder.finishWorkout() let workoutRouteBuilder = HKWorkoutRouteBuilder(healthStore: healthStore, device: hkDevice) try await workoutRouteBuilder.insertRouteData(filteredLocations) try await workoutRouteBuilder.finishRoute(with: workout, metadata: nil) However, I’m encountering two issues: The workouts appear in Apple Fitness but do not contribute to the activity rings. The workout includes a route (visible in the raw workout data in Apple Health) but does not display on Apple Fitness. Is there any way to fix this? I’d appreciate any suggestions you might have. __
2
0
747
Jan ’25
Extended Runtime Session vs HKWorkoutSession Issues
I am working on an Apple Watch companion app to an existing live iOS app. I am utilizing the heart rate tracking for an active 'self-care' sauna session. I say self-care in quotes because it's more self-care than a workout activity, but it is closely blurring the lines between the two. I have come to understand that if a session truly isn't a workout, then you should not use workoutSession.startActivity. However the app needs to function entirely like a workout would. This is not a meditation application. Sauna is actually just one of many activity types supported in the app. I have tried using extended runtime session, and there have been numerous issues with doing so. It is not nearly as robust for the user. For example, the active session is not prioritized by the watch's CPU. Now playing is no longer functional. Heart rate is far more inconsistent, and this variable is as critical as if it were in a workout. I have tried using HKWorkoutSession, however I worry the app will be rejected by doing so. This method works most accurately to collect the right data for the user, and prioritizes system resources as expected. The app can be moved to the background as expected and continue to communicate with the iOS app. What is the best way to move forward here. It almost feels like I am operating in a grey area with no real solution in place. Any assistance is greatly appreciated as we would like to follow all guidelines while producing a high quality experience for our users.
2
0
793
Jan ’25
Can't create energy goals in WorkoutKit
I can create WorkoutGoals of all kinds except .energy, but I can't find any indication of the conditions under which energy goals can be used. No matter what I try, the response from supportsGoal is always false e.g. CustomWorkout.supportsGoal(.energy(10, .kilojoules), activity: .running, location: .outdoor) CustomWorkout.supportsGoal(.energy(10, .calories), activity: .cycling, location: .outdoor) CustomWorkout.supportsGoal(.energy(10, .kilocalories), activity: .running, location: .outdoor) For any combination I've tried, I get Not supported due to unsupportedGoal Has anybody managed to successfully create energy goals?
2
0
795
Jan ’25
Location of indoor workouts
In the fitness app under iOS 18, the location of all workouts is displayed on a small map. For workouts with routes, I can already successfully read out the route and thus also determine the starting point. So that works. For indoor workouts such as yoga or indoor rowing, the exact location is also displayed in the fitness app. I would now also like to read out this location for these indoor workouts in my app. Does anyone know how to do this?
2
0
799
Apr ’25
Walking/Running Distance not included in daily total
Hi, I have an iPhone/watch app that measures walking/running distance. It starts a workout session records data successfully into healthkit and then ends the workout session. I can see the data in the Health app from my app and it all appears to be correct. The issue I'm having is that the Health app doesn't use my app's data in its total distance for the day. For example, I can add 1 mile of fake data (I know that's not allowed per policy) for testing and it gets successfully added but not used in the total. The health app is only using distances collected by the watch and the phone for calculating the total distance for the day and is ignoring the distance provided by my app. What could I be missing?
2
0
670
Feb ’25
Has HealthKit Changed GPS Standards in iOS 18.4 Beta 4?
I am a developer from mainland China. Today, I noticed that the HKWorkoutRoute data stored by my app in HealthKit shows significant discrepancies when viewed on the workout route map in the Health and Fitness apps on iOS 18.4. Instead of displaying the actual movement path, the route appears to be offset by several hundred meters. I collected this data using my app on watchOS 11.3.1, and all CLLocation data comes directly from Core Location. I did not convert WGS84 standard data to GCJ02. Reviewing historical data, all workout routes before March 17, 2025, appear correct, but every record after that date exhibits the offset issue.
2
0
86
Mar ’25
怎样读取健康记录心理状态的情境,并将自己APP的数据传入进去
读取是不是解析 metadata 的对应键来获取值对吧~但我看了相关开发文档好像没找到这个的键是什么~于是也没法写入到对应的,现在只能自定义键来进行写入 但是这样写入后无法显示在心情下方的影响因素后面~ 这个 key 是没公开的吗还是说我方法弄错了~请各位大大指教
2
0
68
May ’25
Statistics collection query first result returned is wrong
I'm reading hourly statistics from HealthKit using executeStatisticsCollectionQuery (code below). Expectation What I expect is to get back the list with one row per hour, where each hours has the same cumulative sum value. Actual result In results, first hour always contains less calories than next hours, which all have the same value. Example: Start: 2025-06-02T00:00:00+03:00, anchor: 2025-06-02T00:00:00+03:00, end: 2025-06-02T12:00:00+03:00 🟡 2025-06-02T00:00:00+03:00 Optional(50.3986 kcal) 🟡 2025-06-02T01:00:00+03:00 Optional(64.421 kcal) 🟡 2025-06-02T02:00:00+03:00 Optional(64.421 kcal) 🟡 2025-06-02T03:00:00+03:00 Optional(64.421 kcal) 🟡 2025-06-02T04:00:00+03:00 Optional(64.421 kcal) 🟡 2025-06-02T05:00:00+03:00 Optional(64.421 kcal) 🟡 2025-06-02T06:00:00+03:00 Optional(64.421 kcal) 🟡 2025-06-02T07:00:00+03:00 Optional(64.421 kcal) 🟡 2025-06-02T08:00:00+03:00 Optional(64.421 kcal) 🟡 2025-06-02T09:00:00+03:00 Optional(64.421 kcal) 🟡 2025-06-02T10:00:00+03:00 Optional(64.421 kcal) 🟡 2025-06-02T11:00:00+03:00 Optional(64.421 kcal) 🟡 2025-06-02T12:00:00+03:00 Optional(14.0224 kcal) As you can see, here we have 2025-06-02T00:00:00+03:00 Optional(50.3986 kcal) Now, if I add one more hour to the request (from beginning of time window), the same hour has proper calories count, while newly added hour, has wrong value): 2025-06-01T23:00:00+03:00, anchor: 2025-06-01T23:00:00+03:00, end: 2025-06-02T12:00:00+03:00. 🟡 2025-06-01T23:00:00+03:00 Optional(50.3986 kcal) 🟡 2025-06-02T00:00:00+03:00 Optional(64.421 kcal) 🟡 2025-06-02T01:00:00+03:00 Optional(64.421 kcal) 🟡 2025-06-02T02:00:00+03:00 Optional(64.421 kcal) 🟡 2025-06-02T03:00:00+03:00 Optional(64.421 kcal) 🟡 2025-06-02T04:00:00+03:00 Optional(64.421 kcal) 🟡 2025-06-02T05:00:00+03:00 Optional(64.421 kcal) 🟡 2025-06-02T06:00:00+03:00 Optional(64.421 kcal) 🟡 2025-06-02T07:00:00+03:00 Optional(64.421 kcal) 🟡 2025-06-02T08:00:00+03:00 Optional(64.421 kcal) 🟡 2025-06-02T09:00:00+03:00 Optional(64.421 kcal) 🟡 2025-06-02T10:00:00+03:00 Optional(64.421 kcal) 🟡 2025-06-02T11:00:00+03:00 Optional(64.421 kcal) 🟡 2025-06-02T12:00:00+03:00 Optional(14.0224 kcal) And now first hour of the day, magically has more calories burned: 2025-06-02T00:00:00+03:00 Optional(64.421 kcal) I suspect similar things happen with other quantity types, but haven't yet found a way to reproduce it. Am I doing something wrong or is it a bug in HealthKit? Code let anchorDate = startDate let predicate = HKQuery.predicateForSamples(withStart: startDate, end: endDate, options: [.strictStartDate]) healthStore.executeStatisticsCollectionQuery( quantityType: .basalEnergyBurned, quantitySamplePredicate: predicate, options: [.separateBySource, .cumulativeSum], anchorDate: anchorDate, intervalComponents: DateComponents(hour: 1), initialResultsHandler: { statistics, error in if let error = error { log(.error, "Error retrieving steps: \(error.localizedDescription)") continuation.resume(throwing: SpikeException("Error retrieving steps: \(error.localizedDescription)")) return } if let statistics { let f = ISO8601DateFormatter() f.timeZone = TimeZone.current for s in statistics { log(.debug, "\(f.string(from: s.startDate)) \(s.sumQuantity())") } } continuation.resume(returning: statistics ?? []) } )
2
0
69
Jul ’25
HealthKit Permission request throws error
Hi guys, We have an app that consumes data from Apple HealthKit. We use an HKObserverQuery to monitor changes in HealthKit data, and occasionally use regular HKSampleQuery requests when the app is in the foreground. Over the past few weeks, we’ve been encountering a significant number of errors when requesting additional HealthKit permissions (beyond what the user has already granted). The error message we’re seeing is: The operation couldn't be completed. (_UIViewServiceInterfaceErrorDomain error 2.) When this error occurs, all previously granted HealthKit permissions are automatically revoked, which is highly disruptive. We have a few questions and would greatly appreciate any insights or explanations regarding this behavior: Could this error occur if a permission request is triggered right as the app moves to the background? Why would previously granted permissions be revoked automatically after this error? If this is due to some internal behavior in iOS (e.g., a system-level protection or timeout), is there any known workaround or best practice to prevent this from happening? Thanks in advance for your help!
2
0
78
Jul ’25
HealthKit Background Delivery and URLSession.shared.dataTask
Hello. I have implemented background delivery for detecting changes in health kit with HKObserverQuery. It works well, I am reading changes. And I am sending this changes to an https endpoint with using an URLSession.shared.dataTask inside the HKObserverQuery callback while my app is terminated. I have several questions about this: Is starting a URLSession.shared.dataTask inside HKObserverQuery callback when app is terminated is correct way to do it? I am calling HKObserverQuery completion handler whatever dataTask returned success or failure but I am wondering what if the network connection is low and this dataTask response could not received in 2-3 seconds. I have read background deliveries should take 1-2 seconds. Should I use an URL session with background configuration for sending those HTTPS requests? If so, should I use download task or upload task (they don't fit my requirements I am sending a simple json)?
2
0
74
Aug ’25
Extremely persistent HealthKit read permissions issue
Overview of Issue My implementation of HealthKit is no longer able to read values due to authorization issues (ex. "HealthKitService: Not authorized to read HKQuantityTypeIdentifierHeight. Status: 0"). I have been through every conceivable debugging step including building a minimal project that just requests HealthKit data and the issue has persisted. I've tried my personal as well as Organizational developer teams. My MacOS and Mac Mini. Simulator and personal device. Rechecked entitlements, reprovisioned certificates. This makes no sense. And I have been unable to find anything similar in the Developer forums or documentation. The problem occurs during the onboarding flow when the app requests HealthKit permissions. Even when the user grants permission in the HealthKit authorization sheet, the authorizationStatus for characteristic data types (like Biological s3x and Date of Birth) and quantity data types (like Height and Weight) consistently returns as .sharingDenied. This prevents the app from pre-filling the user's profile with their HealthKit data, forcing them to enter it manually. The issue seems to be environmental rather than a specific code bug, as it has been reproduced in a minimal test case app and persists despite extensive troubleshooting. Minimal test project: https://github.com/ChristopherJones72521/HealthKitTestApp** STEPS TO REPRODUCE Build app, attempt to sign in. No data is imported into the respective fields in the main app. Console logs confirm. PLATFORM AND VERSION iOS Development environment: Xcode Version 16.4 (16F6), macOS 15.5 (24F74) Run-time configuration: iOS 18.5 Relevant Code Snippets Here are the key pieces of code that illustrate the implementation and the problem: 1. Requesting HealthKit Permissions (HealthKitService.swift) This function is called to request authorization for the required HealthKit data types. The typesToRead and typesToWrite are defined in a centralized HealthKitTypes struct. // HealthKitService.swift func requestPermissions(completion: @escaping (Bool, Error?) -> Void) { guard HKHealthStore.isHealthDataAvailable() else { completion(false, HealthKitError.notAvailable) return } let typesToRead: Set<HKObjectType> = [ HKObjectType.characteristicType(forIdentifier: .dateOfBirth)!, HKObjectType.characteristicType(forIdentifier: .biologicals3x)!, HKObjectType.quantityType(forIdentifier: .height)!, HKObjectType.quantityType(forIdentifier: .bodyMass)! ] let typesToWrite: Set<HKSampleType> = [ HKObjectType.workoutType(), HKObjectType.quantityType(forIdentifier: .activeEnergyBurned)! ] healthStore.requestAuthorization(toShare: typesToWrite, read: typesToRead) { success, error in DispatchQueue.main.async { if let error = error { print("HealthKitService: Error requesting authorization: \(error.localizedDescription)") completion(false, error) } else { print("HealthKitService: Authorization request completed. Success: \(success)") completion(success, nil) } } } } 2. Reading Biological s3x (HealthKitService.swift) This function attempts to read the user's biological s3x. The print statements are included to show the authorization status check, which is where the issue is observed. // HealthKitService.swift func readBiologicals3x() async throws -> HKBiologicals3xObject? { guard HKHealthStore.isHealthDataAvailable() else { throw HealthKitError.notAvailable } let s3xAuthStatus = healthStore.authorizationStatus(for: HKObjectType.characteristicType(forIdentifier: .biologicals3x)!) print("HealthKitService: Auth status for Biological s3x: \(s3xAuthStatus.rawValue)") guard s3xAuthStatus == .sharingAuthorized else { print("HealthKitService: Not authorized to read Biological s3x.") throw HealthKitError.notAuthorized } do { return try healthStore.biologicals3x() } catch { print("HealthKitService: Error executing biologicals3x query: \(error.localizedDescription)") throw HealthKitError.queryFailed(error) } } 3. Calling HealthKit Functions During Onboarding (OnboardingFlowView.swift) This is how the HealthKitService is used within the onboarding flow. The requestHealthKitAndPrefillData function is called after the user signs in, and it attempts to read the data to pre-fill the profile form. // OnboardingFlowView.swift func readHealthKitDataAsync() async { print("Attempting to read HealthKit data async...") // ... (calls to HealthKitService.shared.readDateOfBirth(), readHeight(), etc.) do { if let biologicals3xObject = try await HealthKitService.shared.readBiologicals3x() { if self.selectedGender == nil { switch biologicals3xObject.biologicals3x { case .female: self.selectedGender = .female case .male: self.selectedGender = .male case .other: self.selectedGender = .other default: break } } } } catch { print("OnboardingFlowView: Error reading Biological s3x: (error.localizedDescription)") } print("OnboardingFlowView: Finished HealthKit data processing.") } Console Logs Attempting to read HealthKit data async... HealthKitService: Reading Date of Birth... HealthKitService: Current auth status for DOB (during read attempt): 0 HealthKitService: Not authorized to read Date of Birth. Status: 0 OnboardingFlowView: Error reading Date of Birth: The operation couldn’t be completed. (Strike_Force.HealthKitError error 2.) HealthKitService: Reading Height... HealthKitService: Current auth status for HKQuantityTypeIdentifierHeight (during read attempt): 0 HealthKitService: Not authorized to read HKQuantityTypeIdentifierHeight. Status: 0 OnboardingFlowView: Error reading Height: The operation couldn’t be completed. (Strike_Force.HealthKitError error 2.) HealthKitService: Reading Weight (Body Mass)... HealthKitService: Current auth status for HKQuantityTypeIdentifierBodyMass (during read attempt): 0 HealthKitService: Not authorized to read HKQuantityTypeIdentifierBodyMass. Status: 0 OnboardingFlowView: Error reading Weight: The operation couldn’t be completed. (Strike_Force.HealthKitError error 2.) HealthKitService: Pre-read check for Biologicals3x auth status: 1 (Denied) HealthKitService: Reading Biological s3x... HealthKitService: Current auth status for Biological s3x (during read attempt): 1 HealthKitService: Not authorized to read Biological s3x. Status: 1 OnboardingFlowView: Error reading Biological s3x: The operation couldn’t be completed. (Strike_Force.HealthKitError error 2.)
2
0
178
2w
Old HealthKit samples from WatchOS getting deleted and recreated years later
I have recently come across a couple of odd HealthKit step samples from WatchOS. They represent step data measured in 2022 by my Apple Watch, but they have a creation date ("Date Added to Health") within the past couple of days. These odd samples show a "View All Quantities" button at the bottom of the sample Details page in the Health app on iOS 26 (which I've never seen before); the button leads to a list of many small step quantities, almost as if some older, smaller samples were consolidated into these newer samples. Even weirder is that at least some of these samples seem to be getting re-created repeatedly. For example, I've seen the same sample with a "Date Added to Health" of 9/5/25, then 9/8/25, twice on 9/9/25, and twice on 9/10/25. These samples were originally created by WatchOS 9, and are not being deleted/recreated by any apps on my device. I have only observed it since I updated to the iOS 26 beta (and now the RC); my watch was still running iOS 18 the first time it happened, but it has also happened since my watch was updated to WatchOS 26 beta. I did some debug printing of the odd samples and the normal samples surrounding them for comparison. Here's a normal sample: Sample: 80AC5AC5-CBD7-4581-B275-0C2ACA35B7B4 6 count 80AC5AC5-CBD7-4581-B275-0C2ACA35B7B4, (9.0), "Watch6,1" (9.0) "Apple Watch" (2022-09-15 16:20:14 -0500 - 2022-09-15 16:20:16 -0500) Device: <<HKDevice: 0x10591eee0>, name:Apple Watch, manufacturer:Apple Inc., model:Watch, hardware:Watch6,1, software:9.0, creation date:2022-08-25 18:22:26 +0000> Source revision: <HKSourceRevision name:My Apple Watch, bundle:com.apple.health.EE83959D-D009-4BA0-83A5-2E5A1CC05FE6, version:9.0, productType:Watch6,1, operatingSystemVersion:9.0> Source: <HKSource:0x110588690 "My Apple Watch", bundle identifier: com.apple.health.EE83959D-D009-4BA0-83A5-2E5A1CC05FE6, localDeviceSource: 0, modification date: 2024-01-31 05:49:18 +0000> Date added: 2022-09-15 21:20:16 +0000 Days between end and add: 0 And here's one of the odd samples: Sample: 4982487F-1189-4F16-AB00-61E37818A66D 676 count 4982487F-1189-4F16-AB00-61E37818A66D, (9.0), "iPhone12,1" (16.2) "Apple Watch" metadata: { HKMetadataKeySyncIdentifier = "6:38082859-D9C8-466A-8882-53443B2A2D94:684969619.25569:684970205.31182:119"; HKMetadataKeySyncVersion = 1; } (2022-09-15 16:20:19 -0500 - 2022-09-15 16:30:05 -0500) Device: <<HKDevice: 0x10591ce40>, name:Apple Watch, manufacturer:Apple Inc., model:Watch, hardware:Watch6,1, software:9.0, creation date:2022-08-25 18:22:26 +0000> Source revision: <HKSourceRevision name:My Apple Watch, bundle:com.apple.health.EE83959D-D009-4BA0-83A5-2E5A1CC05FE6, version:9.0, productType:iPhone12,1, operatingSystemVersion:16.2> Source: <HKSource:0x110588640 "My Apple Watch", bundle identifier: com.apple.health.EE83959D-D009-4BA0-83A5-2E5A1CC05FE6, localDeviceSource: 0, modification date: 2024-01-31 05:49:18 +0000> Date added: 2025-09-08 21:11:12 +0000 Days between end and add: 1088 Here's that same odd sample a day later, apparently recreated: Sample: 9E8B12FC-048D-4ECD-BE5B-D387AADE5130 676 count 9E8B12FC-048D-4ECD-BE5B-D387AADE5130, (9.0), "iPhone12,1" (16.2) "Apple Watch" metadata: { HKMetadataKeySyncIdentifier = "6:38082859-D9C8-466A-8882-53443B2A2D94:684969619.25569:684970205.31182:119"; HKMetadataKeySyncVersion = 1; } (2022-09-15 16:20:19 -0500 - 2022-09-15 16:30:05 -0500) Device: <<HKDevice: 0x12f01c4e0>, name:Apple Watch, manufacturer:Apple Inc., model:Watch, hardware:Watch6,1, software:9.0, creation date:2022-08-25 18:22:26 +0000> Source revision: <HKSourceRevision name:My Apple Watch, bundle:com.apple.health.EE83959D-D009-4BA0-83A5-2E5A1CC05FE6, version:9.0, productType:iPhone12,1, operatingSystemVersion:16.2> Source: <HKSource:0x12f0f8230 "My Apple Watch", bundle identifier: com.apple.health.EE83959D-D009-4BA0-83A5-2E5A1CC05FE6, localDeviceSource: 0, modification date: 2024-01-31 05:49:18 +0000> Date added: 2025-09-09 20:53:18 +0000 Days between end and add: 1089 It's worth pointing out some differences between the "normal" and "odd" samples (besides the "View All Quantities" button in the Health app). The recreated "odd" samples have a different Source Revision - the "productType" and "operatingSystemVersion" refer to my iPhone, not the Apple Watch device that actually captured the samples. The odd samples also have metadata keys that don't exist in the other samples - HKMetadataKeySyncIdentifier and HKMetadataKeySyncVersion. Questions I'm hoping someone can help with: What are these samples? Why/how do they have a "View All Quantities" button that shows sub-samples? Is this new to iOS 26? Why are some of the samples getting recreated multiple times?
2
0
88
1w
Sleep Score API access
New in iOS 26 and WatchOS 26 is a Sleep Score calculation for users based on Duration, Bedtime and Interruptions. Unfortunately I can't find any APIs for developers to tap into this metric. Yes, in theory it's all created off the same Sleep Analysis data already available with HealthKit but that makes it very hard to recreate in our apps. If the numbers don't match up exactly, users will understandably complain. Can anyone confirm that this is the case and I've not missed a Sleep Score API? I'll then file feedback. Hopefully this doesn't go the way of Heart Rate Zones where the Apple Watch iPhone app has generated them for years and provided no way for third party apps to access these values (yes many feedbacks provided previously).
2
0
132
2d
HKObserverQuery not working in background
I'm developing a single target watchOS app that obtains HealthKit information. I have the "Background Delivery" option checked under "Signing &amp; Capabilities" for the watch target. The app does HKObserverQueries in the foreground that work as I would expect. But when I click the Digital Crown to return to clock face, the HKObserverQuery activity stops. I'm using Xcode 15.4, on Mac 14.5 and a Apple Watch Series 4 running 10.5.
3
0
740
Mar ’25
How to send a simple request when HKObserverQuery triggered in background?
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.
3
0
986
Oct ’24
App's domain being blocked/rerouted by Apple
I have a strange situation and I'm not sure where else to post this. Our app's domain (or at least its API hostname in the domain) resolves to something different only inside of Apple's network. I was able to get an Apple employee to verify this by resolving the API hostname while on Apple's corporate network and it resolves to an IP that is in Apple's 17.0.0.0/8 network, but everywhere else resolves to the normal IPs. Our domain's DNS is provided by Cloudflare and they are not doing anything special for Apple's network. This is causing problems during App Review because the app is trying to reach our API to log in and instead is being routed to an IP in Apple's network, so it fails SSL validation and presents an error dialog. App Review is then claiming our app doesn't work and rejecting it. This is an app that has been in the App Store for over a decade and gone through countless app reviews. App Review was of no help resolving this and I don't know where else to turn. How can I find out why our domain is being rerouted inside of Apple and get this fixed?
3
0
505
Feb ’25
HKHealthStore().execute(query) will block main thread
HKHealthStore().execute(query) run in main thread it cost 3.5s here is my code print("execute begin:(Date().timeIntervalSince1970)") HKHealthStore().execute(query) print("execute end:(Date().timeIntervalSince1970)") query.predicate like this (startDate >= CAST(0.000000, "NSDate") AND endDate < CAST(0.100000, "NSDate") AND startDate < CAST(0.100000, "NSDate")) OR (startDate >= CAST(60.000000, "NSDate") AND endDate < CAST(60.100000, "NSDate") AND startDate < CAST(60.100000, "NSDate")) OR (startDate >= CAST(120.000000, "NSDate") AND endDate < CAST(120.100000, "NSDate") AND startDate < CAST(120.100000, "NSDate")) OR (startDate >= CAST(180.000000, "NSDate") AND endDate < CAST(180.100000, "NSDate") AND startDate < CAST(180.100000, "NSDate")) OR (startDate >= CAST(240.000000, "NSDate") AND endDate < CAST(240.100000, "NSDate") AND startDate < CAST(240.100000, "NSDate")) OR (startDate >= CAST(300.000000, "NSDate") AND endDate < CAST(300.100000, "NSDate") AND startDate < CAST(300.100000, "NSDate")) OR (startDate >= CAST(360.000000, "NSDate") AND endDate < CAST(360.100000, "NSDate") AND startDate < CAST(360.100000, "NSDate")) OR (startDate >= CAST(420.000000, "NSDate") AND endDate < CAST(420.100000, "NSDate") AND startDate < CAST(420.100000, "NSDate")) OR (startDate >= CAST(480.000000, "NSDate") AND endDate < CAST(480.100000, "NSDate") AND startDate < CAST(480.100000, "NSDate")) OR (startDate >= CAST(540.000000, "NSDate") AND endDate < CAST(540.100000, "NSDate") AND startDate < CAST(540.100000, "NSDate")) OR (startDate >= CAST(600.000000, "NSDate") AND endDate < CAST(600.100000, "NSDate") AND startDate < CAST(600.100000, "NSDate")) OR (startDate >= CAST(660.000000, "NSDate") AND endDate < CAST(660.100000, "NSDate") AND startDate < CAST(660.100000, "NSDate")) OR (startDate >= CAST(720.000000, "NSDate") AND endDate < CAST(720.100000, "NSDate") AND startDate < CAST(720.100000, "NSDate")) OR (startDate >= CAST(780.000000, "NSDate") AND endDate < CAST(780.100000, "NSDate") AND startDate < CAST(780.100000, "NSDate")) OR (startDate >= CAST(840.000000, "NSDate") AND endDate < CAST(840.100000, "NSDate") AND startDate < CAST(840.100000, "NSDate")) OR (startDate >= CAST(900.000000, "NSDate") AND endDate < CAST(900.100000, "NSDate") AND startDate < CAST(900.100000, "NSDate")) OR (startDate >= CAST(960.000000, "NSDate") AND endDate < CAST(960.100000, "NSDate") AND startDate < CAST(960.100000, "NSDate")) OR (startDate >= CAST(1020.000000, "NSDate") AND endDate < CAST(1020.100000, "NSDate") AND startDate < CAST(1020.100000, "NSDate")) OR (startDate >= CAST(1080.000000, "NSDate") AND endDate < CAST(1080.100000, "NSDate") AND startDate < CAST(1080.100000, "NSDate")) OR (startDate >= CAST(1140.000000, "NSDate") AND endDate < CAST(1140.100000, "NSDate") AND startDate < CAST(1140.100000, "NSDate")) OR (startDate >= CAST(1200.000000, "NSDate") AND endDate < CAST(1200.100000, "NSDate") AND startDate < CAST(1200.100000, "NSDate")) OR (startDate >= CAST(1260.000000, "NSDate") AND endDate < CAST(1260.100000, "NSDate") AND startDate < CAST(1260.100000, "NSDate")) OR (startDate >= CAST(1320.000000, "NSDate") AND endDate < CAST(1320.100000, "NSDate") AND startDate < CAST(1320.100000, "NSDate")) OR (startDate >= CAST(1380.000000, "NSDate") AND endDate < CAST(1380.100000, "NSDate") AND startDate < CAST(1380.100000, "NSDate")) OR (startDate >= CAST(1440.000000, "NSDate") AND endDate < CAST(1440.100000, "NSDate") AND startDate < CAST(1440.100000, "NSDate")) OR (startDate >= CAST(1500.000000, "NSDate") AND endDate < CAST(1500.100000, "NSDate") AND startDate < CAST( Log execute begin:1739958803.531026 execute end:1739958807.0448961
3
0
618
Feb ’25
Recording a HeartbeatSeries
I need to be able to create and store a HeartbeatSeries for a given time-period from an Apple Watch, to then retrieve that data from HealthKit to be processed. I have working code which allows me to begin a workout session, which is being used to determine how long a session has been running for. I also have working code for retrieving HeartbeatSeries data from HealthKit. The issue is that no HeartbeatSeries data is being stored into HealthKit as a result of the workout session running. Whether that session is running for as little as 30 seconds or as long as 20 minutes, nothing is stored. However, when I use the the Apple "Meditation" app (formerly known as "Breathe"), I can query HealthKit afterwards and retrieve a list of individual heartbeat timings during that 2 minute period. Therefore, it IS possible to store a HeartbeatSeries from within an app on the Apple Watch. What I would like to know is, how can I use the pulse sensor built-in to the Apple Watch to be able to record a HeartbeatSeries similar to how the Meditation app does it.
3
0
92
Mar ’25