Mj.B
Mj.B

Reputation: 301

Could not collect Heart rate at the end of a fitness task from ios ResearchKit

I wear an Apple Watch, which collects my heart rate periodically and sends it to the Health App in my iPhone.

Now I have created a Fitness task (code below) and trying to read the heartrate of the user's activity. but could not. It says Error No collected data was found. in Recorder: heartRate

    ORKOrderedTask *fitnessTask = [ORKOrderedTask fitnessCheckTaskWithIdentifier:@"FitnessTask"
                                                      intendedUseDescription:@"Intended Use"
                                                                walkDuration:6*60
                                                                restDuration:3*60
                                                                     options:ORKPredefinedTaskOptionNone];

The Results recorded Pedometer, Accelerometer and Device motion... But How can I read the heart rate of the user?

Do I have to do any set up with the Apple watch as well before the task is started? What am I missing?

Upvotes: 1

Views: 148

Answers (1)

Yuan
Yuan

Reputation: 133

Apple Watch doesn't stream heart rate to HealthKit on the phone, you need to find a BTLE heart rate strap and connect it directly to the phone via settings->Bluetooth. And make sure you can see the real time heart rate showing up in Health app. Then ResearchKit can collect heart rate during the task.

Upvotes: 4

Related Questions