I need to execute particular task when application state is background/terminated.
Task has to fetch data from CoreData
table and form a JSON
and then Sync to server using REST API Call
using URLSession.shared
.
I have precisely followed the documentation from Apple and couple of blogs to setup background job from Coding & Xcode configurations perspective.
I have set time-interval to 1
minute after App goes into background for BGAppRefreshTask
.
request.earliestBeginDate = Date(timeIntervalSinceNow: 60)
Knowing the fact that, iOS system has many parameters to meet to execute background fetch. I waited for 24 hours for application to run the background job, but didn't executed job for single time even.
Please share, If anybody has experienced the same and come out with particular solution or justification.
Reference links which I followed.
https://www.andyibanez.com/posts/modern-background-tasks-ios13/