- Install the react-native-health package from npm
yarn add react-native-health
- If you are using CocoaPods you can run the following
from the
ios/
folder of your app
pod install
Or, if you need to manually link it, run
react-native link react-native-health
- Update the
info.plist
file in your project
<key>NSHealthShareUsageDescription</key>
<string>Read and understand health data.</string>
<key>NSHealthUpdateUsageDescription</key>
<string>Share workout data with other apps.</string>
- Run
yarn add react-native-health
- In XCode, in the project navigator, right-click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-health
and addRCTAppleHealthkit.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRCTAppleHealthkit.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Click
RCTAppleHealthkit.xcodeproj
in the project navigator and go theBuild Settings
tab. Make sure 'All' is toggled on (instead of 'Basic'). In theSearch Paths
section, look forHeader Search Paths
and make sure it contains both$(SRCROOT)/../../react-native/React
and$(SRCROOT)/../../../React
- mark both asrecursive
. - Enable Healthkit in your application's
Capabilities
- Compile and run