<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKError/errorHealthDataRestricted",
  "metadataVersion" : "0.1.0",
  "role" : "Type Property",
  "symbol" : {
    "kind" : "Type Property",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "s:SC11HKErrorCodeLeV25errorHealthDataRestrictedSoAAVvpZ"
  },
  "title" : "errorHealthDataRestricted"
}
-->

# errorHealthDataRestricted

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

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

## Discussion

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

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)