Understanding how BGTaskScheduler and background execution windows behave in modern iOS.
You register a BGAppRefreshTask and call task.setTaskCompleted(success:) only inside your async network callback. Occasionally the system terminates your app mid-refresh and logs a crash. What is the most likely cause and correct fix?