Welcome!
I has been found a small interesting Issue.
It looks like just in Emulator working the heart rate.
I tryed with real iPhone SE + Watch (Series 1)
"
guard let quantityType = HKObjectType.quantityType(forIdentifier: HKQuantityTypeIdentifier.heartRate) else { return nil }
let datePredicate = HKQuery.predicateForSamples(withStart: workoutStartDate, end: nil, options: .strictEndDate )
/
let predicate = NSCompoundPredicate(andPredicateWithSubpredicates:[datePredicate])
let heartRateQuery = HKAnchoredObjectQuery(type: quantityType, predicate: predicate, anchor: nil, limit: Int(HKObjectQueryNoLimit)) { (query, sampleObjects, deletedObjects, newAnchor, error) -> Void in
/
/
self.updateHeartRate(sampleObjects)
}
heartRateQuery.updateHandler = {(query, samples, deleteObjects, newAnchor, error) -> Void in
/
self.updateHeartRate(samples)
}
return heartRateQuery
"
Here the heartRateQuery.updateHandler is not fire just in Emulator.
And this Authorisation is working.
"
healthStore.requestAuthorization(toShare:dataTypesToShare() as? Set<HKSampleType>, read: dataTypesToRead()) { (success, error) -> Void in
if let error = error, !success {
print("You didn't allow HealthKit to access these read/write data types. In your app, try to handle this error gracefully when a user decides not to provide access. The error was: \(error.localizedDescription). If you're using a simulator, try it on a device.")
}
}
"
The Apple sample code also not working, the VimoHearthRate app also not working.
I tryed with Team cert..i tryed with normal cert...aaand nothing.
So...this is a new Watch OS 4.0 or Watch Series 1 issue... or my device is bad... or?
Thanks!