URLSession not following 302s on ios 13

Viewed 454

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

My code 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. Is this a bug with iOS 13 or should I be doing something different?

1 Answers

This issue fixed itself with XCode 11 Beta 3.

Related