Enumeration

HKAuthorizationStatus

Constants indicating the authorization status for a particular data type.

Declaration

enum HKAuthorizationStatus : Int

Overview

This status indicates whether the user has authorized your app to save data of the given type.

To help maintain the privacy of sensitive health data, HealthKit does not tell you when the user denies your app permission to query data. Instead, it simply appears as if HealthKit does not have any data matching your query. Your app will receive only the data that it has written to HealthKit. Data from other sources remains hidden from your app. For more information on privacy in HealthKit, see HealthKit.

Topics

Constants

case notDetermined

The user has not yet chosen to authorize access to the specified data type.

case sharingDenied

The user has explicitly denied your app permission to save data of the specified type.

case sharingAuthorized

The user has explicitly authorized your app to save data of the specified type.

See Also

Accessing HealthKit

func authorizationStatus(for: HKObjectType) -> HKAuthorizationStatus

Returns the app’s authorization status for sharing the specified data type.

func getRequestStatusForAuthorization(toShare: Set<HKSampleType>, read: Set<HKObjectType>, completion: (HKAuthorizationRequestStatus, Error?) -> Void)

Indicates whether the system presents the user with a permission sheet if your app requests authorization for the provided types.

enum HKAuthorizationRequestStatus

Values that indicate whether your app needs to request authorization from the user.

class func isHealthDataAvailable() -> Bool

Returns a Boolean value that indicates whether HealthKit is available on this device.

func supportsHealthRecords() -> Bool

Returns a Boolean value that indicates whether the current device supports clinical records.

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

Requests permission to save and read the data types specified by an extension.