Instance Method

disableBackgroundDelivery(for:withCompletion:)

Disables background deliveries of update notifications for the specified data type.

Declaration

func disableBackgroundDelivery(for type: HKObjectType, withCompletion completion: @escaping (Bool, Error?) -> Void)

Parameters

type

The type of data. This object can be any concrete subclass of the HKObjectType class (any of the classes HKCharacteristicType , HKQuantityType, HKCategoryType, HKWorkoutType or HKCorrelationType).

completion

A block that this method calls as soon as the background delivery is disabled. This block is passed the following parameters:

success

A Boolean value. This parameter contains true if the background delivery was successfully disabled; otherwise, false.

error

An error object. If an error occurred, this object contains information about the error; otherwise, it is set to nil.

Discussion

Call this method to prevent your app from receiving any additional update notifications about the specified data type while in the background. This method operates asynchronously. As soon as the background delivery is disabled, this method calls its completion handler on a background queue.

See Also

Managing Background Delivery

enum HKUpdateFrequency

Constants that determine how often the system will launch your app in response to changes to HealthKit data.

func disableAllBackgroundDelivery(completion: (Bool, Error?) -> Void)

Disables all background deliveries of update notifications.