URLSession not following 302s

When running my code on a device that's on iOS 13, I'm getting an error that I'm not seeing on any previous version of iOS. I'm getting: NSURLConnection finished with error - code -1007


The code I'm running is:

URLSession.shared.dataTask(with: url) { (_, res, _) in
 // Do stuff
}.resume()


The server responds with a 302 and resolves fine on the previous iOS versions (redirects once and resolves). On iOS 13 it keeps redirecting to the original URL until it says too many redirects.

Accepted Reply

This issue fixed itself with XCode 11 Beta 3.

Replies

This issue fixed itself with XCode 11 Beta 3.

Hi,

If a server responds with a 302 and for the request to complete with successful response(200)upon redirect, do we have explicitly implement the 'willPerformHTTPRedirection' delegate or do anything else? I'm in short of test data to try this out. A response is highly appreciated.


Thanks