on the line "var anchor = HKQueryAnchor(fromValue: Int(HKAnchoredObjectQueryNoAnchor))" i get the red flag error "cannot convert value of type 'Int' to expected argument type 'Uint'
I had copy-pasted the code from another Xcode project, which brought no error for this line in the other project (reading heart rate on watchOS only).
let healthStore = HKHealthStore()
//State of the app - is the workout activated
var workoutActive = false
// define the activity type and location
var workoutSession : HKWorkoutSession?
let heartRateUnit = HKUnit(fromString: "count/min")
var anchor = HKQueryAnchor(fromValue: Int(HKAnchoredObjectQueryNoAnchor))
The error is telling you exactly what you have to do. Just change the code:
var anchor = HKQueryAnchor(fromValue: UInt(HKAnchoredObjectQueryNoAnchor))
You need to change
UInt, which is what