The HealthKit data is unavailable because the HealthKit data is protected and the device is locked.
- iOS 8.0+
- Mac Catalyst 13.0+
- watchOS 2.0+
This error occurs when your app queries for HealthKit data while the device is locked. You can, however, still save data. This data is saved into a temporary file, which is merged with HealthKit’s data when the user unlocks their device.