title: Health kit enable background delivery is not working properly in iOS 15.5
body: <p>I'm working with integrating healthkit in my app. I have subscribed to active energy burned for background delivery with frequency of one hour. But it's not working properly in iOS 15.5. I have also enabled Background fetch in Capabilities and added HealthKit Observer Query Background Delivery in Entitlements.</p>
  <pre><code>public func initializeBackgroundQueries() {
          if let quantityType = HKObjectType.quantityType(forIdentifier: .activeEnergyBurned) {
              
              print(&quot;Initiate Query, \(#line)&quot;, Date().formatIsoDate(format: .isoDateTimeMilliSec) , &quot;\n&quot;, to: &amp;Log.log)
              
              DispatchQueue.main.async {
                  self.shouldRestartObservers = false
              }
              
            let stepsKey = &quot;steps&quot;
            let query = createObserverQuery(key: stepsKey, sampleType: quantityType, store: healthStore)
            observerQueries[stepsKey] = query
              print(&quot;Execute Query, \(#line)&quot;, Date().formatIsoDate(format: .isoDateTimeMilliSec) , &quot;\n&quot;, to: &amp;Log.log)
            healthStore.execute(query)
            enableBackgroundQueryOnPhone(for: quantityType, at: .hourly, in: healthStore)
          }
      }
      
  private func enableBackgroundQueryOnPhone(for sampleType: HKSampleType, at frequency: HKUpdateFrequency, in store: HKHealthStore) {
          #if os(iOS)
              store.enableBackgroundDelivery(for: sampleType, frequency: frequency, withCompletion: {
                  (success: Bool, error: Error?) in
                  if let error = error {
                      print(&quot;Enable background delivery error: \(error), \(#line)&quot;, Date().formatIsoDate(format: .isoDateTimeMilliSec) , &quot;\n&quot;, to: &amp;Log.log)
                  } else {
                      print(&quot;Enabled background delivery, \(#line)&quot;, Date().formatIsoDate(format: .isoDateTimeMilliSec) , &quot;\n&quot;, to: &amp;Log.log)
                  }
              })
          #endif
      }
  </code></pre>