HKObserverQuery BackgroundDelivery not executed

Hi, I'm having the same issue described in https://developer.apple.com/forums/thread/690974?page=2.

When connected to Xcode or when the app is in the foreground, HKObserverQuery fires correctly and my app processes step updates. But once disconnected from Xcode, background delivery stops completely and the observer callback is never called.

My setup:

  • com.apple.developer.healthkit.background-delivery entitlement is present and in the provisioning profile
  • enableBackgroundDelivery(for: .stepCount, frequency: .immediate) returns success = true
  • HKObserverQuery is registered on every launch including background launches
  • I also have CMPedometer.startEventUpdates running as a supplemental trigger
  • Background Modes includes "Background fetch" and "Background processing"

Device: iPhone, iOS 17.4+
App type: App uses Screen Time / Family Controls (ManagedSettings) to block apps until a step goal is met

Has anyone found a reliable fix?

Any feedback from Apple engineers would be appreciated.

HKObserverQuery BackgroundDelivery not executed
 
 
Q