Skip to main content

Getting started: Ios configuration

Prepare your project for Apple Health.

Ios configuration

On root folder run:

flutter pub get

On ios/Podfile add the following

platform :ios, '13.0'

On ios folder run:

pod install

Open the ios folder with Xcode

Add HealthKit capability to your Xcode project:

  1. Open your project in Xcode.
  2. Click on your project file (most cases is Runner) in the Project Navigator.
  3. Click on the "Signing and capabilities" tab.
  4. Click on the "+ Capability" button and select "HealthKit" from the list.
  5. Check the "Background delivery" option
  6. Click on the "+ Capability" button and select "Background Modes" from the list.
  7. Check the "Background fetch" option

Add HealthKit framework to your Xcode project:

  1. Open your project in Xcode.
  2. Click on your project file (most cases is Runner) in the Project Navigator.
  3. Click on the "Build Phases" tab.
  4. Click on the "+" button under the "Link Binary With Libraries" section and select "HealthKit.framework" from the list.

Declare the privacy permissions used by this SDK. You will need to include the NSHealthShareUsageDescription and NSHealthUpdateUsageDescription keys in your app's Info.plist file.

These keys provide a description of why your app needs to access HealthKit data and will be displayed to the user in the permission request dialog.

  1. Open ios folder
  2. Open Runner folder
  3. Add the following to Info.plist
<key>NSHealthShareUsageDescription</key>
<string>This app requires access to your health and fitness data in order to track your workouts and activity levels.</string>
<key>NSHealthUpdateUsageDescription</key>
<string>This app requires permission to write workout data to HealthKit.</string>