HKObserverQuery BackgroundDelivery not executed

Hi,

before installing iOS 15 our app received HKObserverQuery calls in background, which worked like a charm - the calls have reliably woken up our app in background, enabling it to process new HK data.

In iOS 15 the new entitlement com.apple.developer.healthkit.background-delivery was added, being mandatory if HKObserverQuery calls should be delivered in background. Indeed, we added the entitlement to the Entitlements file and the Provisioning Profile of the app. After doing so, registering with enableBackgroundDelivery(for:frequency:withCompletion:) worked again without an error.

While testing we observed that the app is not called at all. To debug, we captured system logs of an iPhone with iOS 15 - you can find them attached.

It can be seen that HK background delivery tries to fire, but dasd decides to not proceed because of the ApplicationPolicy.

After some research we found this might be related to background modes capabilities. Thus we added "Background fetch" and "Background processing". Anyhow, this did not change the behavior.

Again, this background delivery perfectly worked on iOS 14 - we did not change anything except adding the new background delivery entitlement (and the background processing entitlements in a second try).

Are we missing any (new?) entitlements? Any other news in iOS 15 making further changes necessary? Is HKObserverQuery working for others in background mode?

Thanks in advance for considering and best regards, Nils

Notes on the logs:

  1. App was suspended at all times
  2. iPhone was unlocked from the beginning on
  3. iPhone was locked at 13:16
Post not yet marked as solved Up vote post of Nils-B Down vote post of Nils-B
6.3k views

Replies

Hi, we're getting reports from users that the same problem is happening again too. We're accessing steps and walk/run distance.

We're also getting reports from users on iOS 16, do we have any Apple Support Ticket open on this matter?

Hey, folks! Do you happen to have any updates here? I'm facing the same issue on iOS 16.

Also experiencing the same issues on iOS 16

I am trying to use this background delivery feature on iOS17.3 for HKObjectType.workoutType() and as far as I know the frequency should be immediate for this. As a result, sometimes it is working fine, sometimes does not. When running the app on the device from xcode, it always works, but when opening it directly on the device, like any other app, it rarely works.