TLS error on iOS 12 & 11

When we try to connect to a TLS1.2 enabled server url in AVPlayer without explicitly setting anything in plist file, our media content plays fine in iOS 13.x but for whatever reason, it fails in iOS 11 and iOS 12.
That doesn't make sense since we would expect with iOS 13 the requirements of the server protocols would be more stringent. But it seems to be happening the other way round.

Code Block {Error
Domain=NSURLErrorDomain Code=-1022 \"The resource could not be loaded
because the App Transport Security policy requires the use of a secure
connection.\" UserInfo={NSLocalizedDescription=The resource could not be
loaded because the App Transport Security policy requires the use of a secure
connection., NSUnderlyingError=0x1c12405a0 {Error
Domain=kCFErrorDomainCFNetwork Code=-1022 \"(null


If I'm reading your question correctly it looks like you are trying to use HTTP, and not HTTPS, while loading external content, possibly an HLS stream or a AVPlayer URL? The short answer is to make sure to load all resources over HTTPS to take advantage of security TLS provides your app and then there will not be inconsistencies between iOS versions.

As to your situation, if you are loading an HLS stream, is there an HTTP and HTTPS version of this stream?

Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
Hi Matt

No, the URL we are trying to load is HTTPS. It is NOT HTTP. Its a media file hosted on a server (not HLS).

Which is why we were surprised that it would work fine on iOS 13 but not on iOS 11 or iOS 12.
Thanks for the confirmation that this resource is being loaded via HTTPS. To try and get to the bottom of what is happening here I put a mp4 on a CDN and tested it with HTTPS on iOS 12 and 13 with successful results. In my test I used something like:

Code Block swift
guard let url = URL(string: "https://<url>/video.mp4") else {
return
}
let asset = AVAsset(url: url)
let playerItem = AVPlayerItem(asset: asset)


Can you tell me more about how you are loading your asset using HTTPS? Also, do you have any other logs or information to share? Is there anything in the Console.app that shows up for info or debug when you run into this?


Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
TLS error on iOS 12 & 11
 
 
Q