---
title: errorHealthDataRestricted
framework: healthkit
role: symbol
role_heading: Type Property
path: healthkit/hkerror/errorhealthdatarestricted
---

# errorHealthDataRestricted

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

## Declaration

```swift
static var errorHealthDataRestricted: HKError.Code { get }
```

## 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

### Accessing errors

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