I’m investigating delayed HealthKit background delivery in an iPhone calorie-tracking app installed through TestFlight.
The app reads activeEnergyBurned and submits a local notification with a custom sound for every newly accumulated 20 kcal. The intended behavior is passive: the user walks normally without explicitly starting a workout.
Current behavior:
- Rewards appear after opening the app.
- Unlocking the phone to the iPhone Home Screen does not trigger the accumulated rewards.
- The app is backgrounded, not force-quit.
- A separate local notification scheduled 10 seconds ahead successfully displays and plays its custom sound while the phone is locked.
Implementation:
- An HKObserverQuery for activeEnergyBurned, with predicate nil, is registered during application(_:didFinishLaunchingWithOptions:).
- Background delivery is requested with frequency .immediate.
- The installed TestFlight app has the HealthKit and HealthKit background-delivery entitlements.
- With valid locally stored access, Health processing does not wait for a StoreKit subscription query.
- In the captured trace, observer callbacks complete promptly and healthd reports no outstanding launches afterward.
Recorded test on November 7, 2026 (device-log times, UTC−07:00):
- Around 07:03, I manually added 40 kcal in Apple Health.
- At 07:03:42, Health received an added sample. healthd scheduled the next Active Energy background launch for 08:03:14, approximately one hour after our previous observer completion.
- At 07:05:42, I unlocked to the Home Screen. Protected Health data became available, but no corresponding observer callback reached our app.
- At 07:08:40, I opened our app. Its observer callback arrived immediately, and two reward notification requests were accepted without error.
Earlier development installations appeared to deliver accumulated rewards upon unlocking to the Home Screen, even after the debugger had disconnected. Subscription integration occurred between those versions, but we have not established the cause of the difference.
My questions:
- Is an approximately one-hour interval expected for activeEnergyBurned on iPhone despite requesting .immediate?
- Can foreground observer completions advance the next permitted background delivery time?
- Is there a supported way to receive pending Active Energy updates after unlocking, without opening the app or starting an HKWorkoutSession?
I can provide targeted implementation details and additional relevant log excerpts if needed. Thank you.