Hi,
I am getting an error stating "Argument passed to call that takes no arguments". I want this Apple Watch App to measure and store RR Intervals from the PPG sensor on the Apple Watch for Heart Rate Variability calculations. Please help me fix this, I can't figure it out. Here is my code:
heartbeatQuery = HKHeartbeatSeriesQuery(predicate: predicate,
dataReceivedHandler: { (query, timeSinceLastBeat, ended, error) in
// Switch to main thread for UI updates
DispatchQueue.main.async {
if let error = error {
print("Heartbeat query error: (error.localizedDescription)")
self.fetchErrorMessage = "Heartbeat query error: (error.localizedDescription)"
// Consider stopping the workout session if the query fails critically
// self.stopWorkoutSession()
return
}
if ended {
print("Heartbeat query indicates series ended.")
}
// Append valid RR intervals
if timeSinceLastBeat > 0 {
self.rrIntervals.append(timeSinceLastBeat)
self.beatCount += 1
}
} // End DispatchQueue.main.async
}) // End query data handler
// --- END OF PROBLEMATIC INITIALIZER ---
// Execute the query if it was created successfully
It recommends the fix as removing this part:
'(predicate: predicate,
dataReceivedHandler: { (query, timeSinceLastBeat, ended, error) in
// Switch to main thread for UI updates
DispatchQueue.main.async {
if let error = error {
print("Heartbeat query error: (error.localizedDescription)")
self.fetchErrorMessage = "Heartbeat query error: (error.localizedDescription)"
// Consider stopping the workout session if the query fails critically
// self.stopWorkoutSession()
return
}
if ended {
print("Heartbeat query indicates series ended.")
}
// Append valid RR intervals
if timeSinceLastBeat > 0 {
self.rrIntervals.append(timeSinceLastBeat)
self.beatCount += 1
}
} // End DispatchQueue.main.async
})'
But after I remove that it says "Cannot assign value of type 'HKHeartbeatSeriesQuery.Type' to type 'HKHeartbeatSeriesQuery'" PLEASE HELP ME
Thanks
Selecting any option will automatically load the page