---
title: HKError.Code.errorHealthDataRestricted
framework: healthkit
role: symbol
role_heading: Case
path: healthkit/hkerror/code/errorhealthdatarestricted
---

# HKError.Code.errorHealthDataRestricted

A Mobile Device Management (MDM) profile restricts the use of HealthKit on this device.

## Declaration

```swift
case errorHealthDataRestricted
```

## Mentioned in

Authorizing access to health data

## Discussion

Discussion Because an MDM profile can disable HealthKit on a managed device, always verify that the current device supports HealthKit by calling isHealthDataAvailable() before calling any other HealthKit methods. If HealthKit is restricted (for example, in an enterprise environment), the methods fail with an errorHealthDataRestricted error.

## See Also

### Errors

- [HKError.Code.errorHealthDataUnavailable](healthkit/hkerror/code/errorhealthdataunavailable.md)
- [HKError.Code.errorInvalidArgument](healthkit/hkerror/code/errorinvalidargument.md)
- [HKError.Code.errorAuthorizationDenied](healthkit/hkerror/code/errorauthorizationdenied.md)
- [HKError.Code.errorAuthorizationNotDetermined](healthkit/hkerror/code/errorauthorizationnotdetermined.md)
- [HKError.Code.errorRequiredAuthorizationDenied](healthkit/hkerror/code/errorrequiredauthorizationdenied.md)
- [HKError.Code.errorDatabaseInaccessible](healthkit/hkerror/code/errordatabaseinaccessible.md)
- [HKError.Code.errorUserCanceled](healthkit/hkerror/code/errorusercanceled.md)
- [HKError.Code.errorAnotherWorkoutSessionStarted](healthkit/hkerror/code/erroranotherworkoutsessionstarted.md)
- [HKError.Code.errorUserExitedWorkoutSession](healthkit/hkerror/code/erroruserexitedworkoutsession.md)
- [HKError.Code.errorNoData](healthkit/hkerror/code/errornodata.md)
