Getting an NSURLConnection error only in TestFlight

I'm getting NSURLConnection finished with error - code -1022 error after cleaning the project and building it for the first time, and also when uploaded to the TestFlight.

In NSAppTransportSecurity properties NSAllowsArbitraryLoads is set to true. I also tried adding exceptional domains, but none fixes the issue.

Also, it is weird that everything works fine after running the app for the second time from XCode after cleaning the project.

What can be the reason for this issue?

I'm getting NSURLConnection finished with error - code -1022 error

What URL are you trying to fetch?

Also, why are you using NSURLConnection? That API was deprecated many years ago and, while it’s not going away any time soon, because it’s way too popular for us to remove, it’s well past the time to transition to NSURLSession.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Getting an NSURLConnection error only in TestFlight
 
 
Q