HomeiOS Developmentswift - Stay Actions and Add in Background iOS

swift – Stay Actions and Add in Background iOS


I am growing a brand new function that permits the person to maintain monitor of a background add by way of dwell actions.

Im utilizing the URLSessionTaskDelegate to maintain monitor of the duty progress and it really works tremendous when the app is in foreground, however when the app goes to background, it cease after a number of seconds. The add nonetheless continues and Im in a position to obtain updates on it is completion by way of the utility(_ utility: UIApplication, handleEventsForBackgroundURLSession however solely by way of that.

Additionally after I put the app again to foreground it updates to the proper progress so that is solely occurring in background.

That is the URLSessionConfiguration I am utilizing:

let config = URLSessionConfiguration.background(withIdentifier: "(uploadBackgroundTaskIdentifier)")

config.isDiscretionary = false
config.allowsCellularAccess = true
config.shouldUseExtendedBackgroundIdleMode = true
config.sessionSendsLaunchEvents = true
config.timeoutIntervalForResource = 28800

Does anybody is aware of how ought to I be capable to preserve monitor of the progress even when the app is in background?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments