Prevent iOS from killing the app while suspended

Basically, I have a school app that students would use in class by activating themselves to the current active course, and the app should track students' actions like sending the app to the background to inactivate them.

one more thing to add is that a student can lock his phone while activating himself to preserve the battery.

when the phone is locked, the app is sent to the background state and then to the suspended state.

The issue here is, After a while, if the user unlocks his phone, SOMETIMES user sees the home screen and when he opens the app from the app switcher, App gets relaunched (meaning the system terminates the app while the app was in the suspended state) and In that case, students can cheat the app without noticing it.

I suspect Jetsam (Memory pressure) case is behind this since the app utilizes less than 50 MG of memory while in the background but can't be so sure.

    1. Is there any chance I could prevent this from happening?
    1. Are there any frameworks that could help fix that issue (being terminated while in a suspended state)?

Replies

Re-code the app to contend with what can and variously will happen here; that the app can quite possibly be suspended and resumed.

That re-coding might involve storing the data locally and/or queuing an event for later, or contacting a remote server and logging / tracking the activity there.

And as for your questions, no, and no.

https://developer.apple.com/documentation/uikit/app_and_environment/scenes/preparing_your_ui_to_run_in_the_background/about_the_background_execution_sequence

https://developer.apple.com/documentation/uikit/app_and_environment/scenes/preparing_your_ui_to_run_in_the_background/extending_your_app_s_background_execution_time