authorizationStatus(for:)
Returns the app’s authorization status for sharing the specified data type.
Declaration
func authorizationStatus(for type: HKObjectType) -> HKAuthorizationStatusParameters
- type:
The type of data. This can be any concrete subclass of the Hkobjecttype class (any of the Hkcharacteristictype , Hkquantitytype, Hkcategorytype, Hkworkouttype or Hkcorrelationtype classes).
Mentioned in
Return Value
A value indicating the app’s authorization status for this type. For a list of possible values, see HKAuthorizationStatus.
Discussion
This method checks the authorization status for saving data to the HealthKit store.
To help prevent possible leaks of sensitive health information, your app cannot determine whether or not a user has granted permission to read data. If you are not given permission, it simply appears as if there is no data of the requested type in the HealthKit store. If your app is given share permission but not read permission, you see only the data that your app has written to the store. Data from other sources remains hidden.
See Also
Accessing HealthKit
HKAuthorizationStatusgetRequestStatusForAuthorization(toShare:read:completion:)HKAuthorizationRequestStatusisHealthDataAvailable()supportsHealthRecords()requestAuthorization(toShare:read:completion:)requestAuthorization(toShare:read:)requestPerObjectReadAuthorization(for:predicate:completion:)handleAuthorizationForExtension(completion:)authorizationViewControllerPresenter