Reading time: 4 min
This recipe shows how to perform a GET request in the background using BGTaskScheduler
and BGAppRefreshTaskRequest
. For whatever reason, this has way too many gotchas:
- You can't use Alamofire, you have to use
URLSession
. - You can use
URLSessionDataTask
, it has to be aURLSessionDownloadTask
. Why? Beats me. - You can't use callbacks, you must use delegates to track request progress and completion.
Search our recipes
Check out the companion apps!
Our free companion app and XCode Extension brings 100+ SwiftUI recipes right at your fingertips! Get a preview of it in the Online Companion.
Have a recipe for us?
Get in touch and let's grow the cookbook together!