Alamofire 3.5.1: download stopped when in airplane mode

时间:2016-10-20 13:15:46

标签: ios networking swift2 alamofire xcode7.3

We are experiencing an issue downloading file, when we activate airplane mode. We are using the following Manager configuration:

let configuration = NSURLSessionConfiguration.backgroundSessionConfigurationWithIdentifier(self.sessionIdentifier)
configuration.HTTPMaximumConnectionsPerHost = 1
let manager = Alamofire.Manager(configuration: configuration)

The expected behaviour is that when you activate the airplane mode, the response handler is not called and the download is still active and waiting for the internet connection to be active again. But the response is called and we get the following information:

  • Error:

    Error Domain=NSURLErrorDomain Code=-1002 "unsupported URL" UserInfo={NSLocalizedDescription=unsupported URL}

  • Data:

    nil

  • Response:

    status code: 200, headers { "Accept-Ranges" = bytes; "Cache-Control" = "max-age=604800"; "Content-Length" = 138310665; "Content-Type" = "video/mp4"; Date = "Thu, 20 Oct 2016 13:09:19 GMT"; Etag = "\"3168233889\""; Expires = "Thu, 27 Oct 2016 13:09:19 GMT"; "Last-Modified" = "Fri, 25 Sep 2015 09:38:30 GMT"; Server = "ECAcc (fcn/40BD)"; "X-Cache" = HIT;

  • And the original request

Notice that the error does not contain, even resume data, which I think it should.

And also this is not the case when we test it in the simulator and stop the internet connection.

Any help will be much appreciated!

0 个答案:

没有答案
相关问题