Post

Replies

Boosts

Views

Activity

Heart Rate not accessible on some devices even with all the permissions
I'm developing an app for a client that provides lockscreen widgets for different categories. There are two categories that use healthkit - heart and steps. Heart shows the latest heart rate reading, and steps shows the total steps of the day. The steps widget works perfectly. But, the heart widget doesn't work on the client's phone. The widgets work perfectly on my end. I tested it on multiple devices, and it works perfectly. But, it doesn't work on the client's phone. He tested it on 2-3 devices, and it didn't work on any of them. The permissions to read heart rate are confirmed to be given. I'm in Canada, and the client is in UK. I changed the region on my phone and tried it, but that didn't change anything and the widget again worked on my devices. Now, I tried Sentry to capture the error being received. But all I am getting is this - Could not get heart rate data Optional(Error Domain=com.apple.healthkit Code=6 "Protected health data is inaccessible" UserInfo={NSLocalizedDescription=Protected health data is inaccessible}) The steps widget works perfectly. I checked Sentry, there is no other error. Now, this is the same error, we get on steps widget too when the widget tries to access health kit data when the device is locked. I have failsafes for that. But, the heart rate widget never reads any value on client's device and just gives null. This is how the widget shows on my device. These images are from the client's phone. So, the read permission for heart rate is there. The "E and A no data" on the widget is a debug statement which means that nil is received as the heart rate value. The other widget thus shows 0 which is the failsafe in these cases. Both the devices are on iOS 16.1. Have tested it on simulators too, works perfectly. Have tested it on iOS 16.0. It's just the client's devices that give these errors.
1
0
1.1k
Nov ’22