-
Notifications
You must be signed in to change notification settings - Fork 281
Description
Is your feature request related to a problem? Please describe.
While implementing the react-native-health library, I encountered an error related to missing HealthKit entitlements that wasn't documented in the README. The error was:
"Error with HealthKit authorization: Error Domain=com.apple.healthkit Code=4 "Missing com.apple.developer.healthkit entitlement." UserInfo={NSLocalizedDescription=Missing com.apple.developer.healthkit entitlement.}"
The current documentation mentions adding the necessary NSHealthShareUsageDescription keys to Info.plist, but doesn't describe the required HealthKit entitlements setup.
Describe the solution you'd like
I'd like the README to include a section about setting up HealthKit entitlements with these steps:
- In Xcode, select your project in the Project Navigator
- Select your app target under "Targets"
- Go to the "Signing & Capabilities" tab
- Click the "+ Capability" button
- Search for and add "HealthKit"
Additionally, include information about manually creating an entitlements file if it's not automatically generated:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.healthkit</key>
<true/>
<key>com.apple.developer.healthkit.access</key>
<array/>
</dict>
</plist>Describe alternatives you've considered
As an alternative, I considered adding a troubleshooting section that specifically mentions this error and its solution, rather than including it in the main setup instructions.
Additional context
This issue isn't specific to this library but is a requirement for any HealthKit integration. However, including this information would help developers avoid common setup issues, especially those new to HealthKit integration.