Got it to work with both just taking a picture and using an AVCaptureSession. Do have to see whether or not this framework is good enough for my purpose, but thanks for pointing me to this project. It's really helpful!
Post
Replies
Boosts
Views
Activity
Hope it helped and got you (partially) what you’re looking for!
I’m not sure you can always show and update the Health data whether the device is locked or not. As far as I know and understood the HealthKit database is locked when the device is locked.
You could show a cached version of your latest data. That way you at least show something, unlocking the device will often update it. Still not a 100% what you’re looking for I guess, so if you do find a solution please let me know! :)
Running into this exact problem currently. Have you ever been able to solve this challenge @digitalglen ?
I've asked Apple Support this question about 1,5 year ago and what you would need to do is:
Add the "Data Protection" capability to the main app (so not the Widget extension)
Add “com.apple.developer.default-data-protection” entitlement key with value “NSFileProtectionComplete” to the widget target.
That way the widget will only request new timelines when the data is available (not protected) and you’ll no longer get errors.
If a reload of data would be requested when the device is locked, it will be executed when the device unlocks. Just like Apple's activity rings Lock Screen Widget.
Hope this helps and is what you're looking for!