I've built an app that gathers workout data from healthkit (from external sources) that is saved on a server so that other users can view the workouts in a feed. I initially set up the query to be handled when the app was opened, but then realised that the database only gets updated when the user opens the app which causes issues if they don't open the app for a week.
I've looked into a solution, but it seems as though apple only allows you to access healthkit data when the users phone is unlocked. Is there a way to run a healthkit query whenever a new workout is added to healthkit, that I can deal with in the background?