Error codes that may be returned when calling HealthKit methods.


enum HKError.Code : Int, _ErrorCodeProtocol



case noError

No error occurred.

case errorHealthDataUnavailable

HealthKit is restricted on this device.

case errorHealthDataRestricted

HealthKit is restricted on this device.

case errorInvalidArgument

An invalid argument was provided to the HealthKit API.

case errorAuthorizationDenied

The user has not given the app permission to perform the requested operation.

case errorAuthorizationNotDetermined

Your app has not yet asked the user for the authorization required to complete this task.

case errorRequiredAuthorizationDenied

An error indicating that the user has not granted the application authorization to access all the required data types.

case errorDatabaseInaccessible

The HealthKit data is unavailable because the HealthKit data is protected and the device is locked.

case errorUserCanceled

The user canceled the operation.

case errorAnotherWorkoutSessionStarted

Another app has started a workout session.

case errorUserExitedWorkoutSession

The user exited your application while a workout session was running.

See Also


struct HKError

An error returned from a HealthKit method.

let HKErrorDomain: String

The domain for all HealthKit errors.