[Error] The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.

 

App Transport Security

etc-image-0

 

이때, 오류에서 말하는 App Transport Security는 애플리케이션과 웹 사이트 사이에 통신 시 보안 기능 향상을 위한 기능으로, iOS9 이후로 도입되었다. 이는 모든 인터넷 통신 시 안전한 프로토콜을 사용하도록 권장하는 것으로, http로 접근시작하는 웹사이트나 인증되지 않은 https로 네트워크 통신을 하거나 webView를 띄울 경우 해당 오류가 발생한다. 

 

 

 

 

오류 해결 방법

해결 방법은 두 가지가 있다.

 

 

1. 모든 http 연결을 허용하기

etc-image-1

 

말 그대로 보안이 완전하지 않은 http 웹사이트의 연결도 모두 허용하는 것과... ...

그것보다 조금 더 범위를 줄여 웹 보기 내에서 이루어지는 호출에 대해서 허용할 수도 있다.

 

etc-image-2
https://developer.apple.com/documentation/security/preventing_insecure_network_connections

요것처럼! 

 

 

 

2. 도메인 하나만 ATS 예외로 제한하기

etc-image-3

 

또, ATS 예외를 도메인 하나로만 제한할 수도 있다.

 

 

 

 

 

 

 

https://developer.apple.com/documentation/security/preventing_insecure_network_connections/identifying_the_source_of_blocked_connections

 

Identifying the Source of Blocked Connections | Apple Developer Documentation

Figure out why App Transport Security denies a network connection.

developer.apple.com

https://developer.apple.com/documentation/security/preventing_insecure_network_connections

 

Preventing Insecure Network Connections | Apple Developer Documentation

Enforce secure network links in your app by relying on App Transport Security.

developer.apple.com

https://www.zehye.kr/ios/2020/04/09/14iOS_ats/

 

ATS(App Transport Security)란? · 지혜의 개발공부로그

ATS(App Transport Security)란? 09 Apr 2020 | iOS 개인공부 후 자료를 남기기 위한 목적임으로 내용 상에 오류가 있을 수 있습니다. ATS(App Transport Security) ATS는 애플리케이션과 웹 서비스 사이에 통신 시 보

www.zehye.kr

https://blowmj.tistory.com/entry/iOS-iOS9-App-Transport-Security-설정법

 

[iOS] iOS9 App Transport Security 설정법

iOS9으로 업데이트 되면서, HTTP로 접속을 하거나, 인증되지 않은 HTTPS즉, 정상적인 SSL이 아닌 곳으로 이동이나 webView를 띄우면 아래와 같은 에러가 나게 됩니다.NSURLSession/NSURLConnection HTTP load failed (

blowmj.tistory.com