Skip to content

Add HealthKit entitlements setup instructions to README #412

@HongDuHyeon

Description

@HongDuHyeon

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:

  1. In Xcode, select your project in the Project Navigator
  2. Select your app target under "Targets"
  3. Go to the "Signing & Capabilities" tab
  4. Click the "+ Capability" button
  5. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions