Watchos 4.0 heart rate just on Emulator working?

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!

I am seeing the same issue...getting sample data in the simulator but not on my Series 0 Watch running WatchOS4.1

I'm seeing the same thing. It was working for watchOS 3 but now I'm on watchOS 4.1 and it fails. The error I am getting when I start the query is that I don't have authorization, despite having accepted all permissions on the authorization screen that the OS presents. The error says that authorization cannot be determined. Crazy. My watch is Series 1. Other people running the same code don't have this issue. I hope Apple takes a look at this, if its not fixed I will have to pull support for Apple Watch in my app.

Watchos 4.0 heart rate just on Emulator working?
 
 
Q