Hey! I am making an application that should run the code through 4 hours, how to do it correctly? The device is locked and at rest. "Push Notifications" - it seems to me not suitable...
Running code in the background after 4 hours
AFAIK, you cannot get full control of keeping your app running in background.
May have a look here:
https ://www.hackingwithswift. com/example-code/system/how-to-run-code-when-your-app-is-terminated
May have a look here:
https ://www.hackingwithswift. com/example-code/system/how-to-run-code-when-your-app-is-terminated
It turns out that there is an option with only notifications? There is no way to ask the user to somehow allow this?
No, I don't think that's something a user can request.
I need to turn on "AVAudioPlayer", what if I just turn on the audio in the background without sound so that the application does not block, and after 4 hours I turn on the sound? Is it even possible? Will such an application be missed?
iOS has no general-purpose mechanism for running an app indefinitely in the background (and, no, playing silence in the background is not a supported technique). All of iOS’s background execution modes are tailored to specific user scenarios. If you can post some details about what you’re trying to do, we might be able to suggest a technique that works for that scenario.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
I just need to start "AVAudioplayer" after 4 hours of delay. I understand that this is only possible through a "notification", which greatly complicates my development...