Closed yeralin closed 6 years ago
You need to ask the system for the execution in the background. https://developer.apple.com/documentation/uikit/uiapplication/1623031-beginbackgroundtask
@neekeetab Apparently, dataTask does not support background downloads. Only downloadTask is allowed
I noticed that if I start downloading an audio file using
CachingPlayerItem
, and then lock my phone, the session will be terminated.I tried to quickly fix it by modifying:
let configuration = URLSessionConfiguration.default
tolet configuration = URLSessionConfiguration.background(withIdentifier: "bgSessionConfiguration")
But it didn't work. Seems like it is not that simple, you need to write a handler, and stuff.
Do you know any quick way to download audio in background?