I'm downloading files using NSOperation
(s) and adding them NSOperationQueue
. NSOperationQueue
is getting suspended when app goes in the background. Is there any work around if queue will not suspend in the background and start the next operation?
While your queue is running use the UIApplication beginBackgroundTaskWithExpirationHandler
call to start a background task that will keep your downloads running.
I generally wrap up each operation with its own beginBackgroundTaskWithExpirationHandler
call, and queue the next one up before I call endBackgroundTask
that way the queue keeps running.
note an individual background task is limited to 10 minutes of operation, after that iOS will suspend the app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With