I’m trying to implement background refresh functionality, it will be calling at regular interval of 30min.
I’ve created a BG task schedular request and mentioned earlier begin date also.
It’s working while debugging but not working on device keeping in background.
Registering the task on AppDelegate didFinishWith options
BGTaskScheduler.shared.register(
forTaskWithIdentifier: “IDENTIFIER”,
using: DispatchQueue.global()
) { task in
refreshFunctionality()
}
Submitting refresh task request while app going to background
let request = BGAppRefreshTaskRequest(identifier: "IDENTIFIER")
request.earliestBeginDate = Date(timeIntervalSinceNow: 30 * 60)
do {
try BGTaskScheduler.shared.submit(request)
} catch {
print("Could not schedule app refresh: \(error)")
}
Thank you..!