Is there a good/safe/legal/responsible way for me to run code indefinitely at a scheduled interval while the app is in the background or while it's quitted? I'm trying to build a feature into my app where the user can start a logging system that continuously grabs (local) data and send notifications depending on the data, even while the app is in the background or the device is asleep. My app will also send notifications depending on this data. My app is not pulling/fetching data from an internet/push source.
I've read Apple's documentation on Background Execution and this tutorial on iOS Background Modes. I understand the various types of background modes supported in iOS. What I'm looking for is similar to the Background Fetch feature or the "Whatever" feature, but neither does exactly what I'm looking for (one is scheduled by iOS's own system while other one ends after a finite length).
Thanks in advance for your help!