Alamofire request gets stuck when entering background?
问题 I'm using Alamofire to make a call to a webservice which takes a pretty long time to load. If the app goes into the background I get stuck with my loader when I return to the app. I imagine it's because the call never returns anything to my completion handler. How can I address this problem? 回答1: You can use background fetching to solve this problem. It can be done in the following way in Swift 3: var backgroundTask: UIBackgroundTaskIdentifier? // global variable backgroundTask =