clamp
Clamp
clamp
글쓰기 관리
전체 방문자
오늘
어제
  • 분류 전체보기 (509)
    • IOS (85)
    • SwiftUI+TCA+Combine (9)
    • RxSwift + MVVM (56)
    • Clean Architecture (12)
    • SWIFT (56)
    • iOS - TDD (2)
    • 디자인패턴 (4)
    • CS (56)
      • 알고리즘 (29)
      • 운영체제 (15)
      • 자료구조 (2)
      • 네트워킹 (4)
      • 기타 (6)
    • 회고 (0)
    • Firebase (18)
    • SwiftUI (10)
    • iOS - UIKit (11)
    • iOS - 오픈소스 (6)
    • 코딩테스트 (166)
      • 프로그래머스 (164)
    • 정보처리기사 (14)
    • GitHub (2)
글쓰기 / 관리자

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

인기 글

태그

  • ㅅ
  • Swift
  • uikit
  • Q

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
clamp

Clamp

[iOS] URLSessionTask failed with error: The resource could not be loaded because the App Transport Security policy requires the use of a secure connection. HTTP접근 허용
IOS

[iOS] URLSessionTask failed with error: The resource could not be loaded because the App Transport Security policy requires the use of a secure connection. HTTP접근 허용

2023. 4. 6. 13:14

Alamofire를 사용해 통신을 하다가  다음과 같은 에러가 발생했다.

URLSessionTask failed with error: The resource could not be loaded because the App Transport Security policy requires the use of a secure connection

 

APP Transport Security(ATS):

HTTP에서 보안이 향상된 버전이 HTTPS이며 대부분의 웹이 HTTPS를 사용하고 있지만 그렇지 않은 서비스도 있다.

iOS9 이후로 APP Transport Security(ATS)를 이용하여 HTTP접속을 통한 접속을 기본적으로 차단한다.

 

 

내가 접근한 API

"http://openapi.seoul.go.kr:8088...."

 

http를 사용하고 있기 때문에 이런 에러가 발생한것.

 

해결방법.

1. info.plist 파일을 우클릭해 Source Code로 연다.

 

2. 아래 소스코드를 첫 번째 <dict>아래 붙혀넣는다.

<key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>

 

 

붙혀 넣으면 plist의 Propertylist에선 추가되지 않던 항목들이 생겨난다.

 

저작자표시 비영리 동일조건 (새창열림)
    'IOS' 카테고리의 다른 글
    • [iOS] some키워드?
    • [iOS] KVO(Key-Value Observing)
    • [iOS] SnapKit
    • [iOS] Push Notification(1). Remote Notification , APNs
    clamp
    clamp
    주니어 iOS개발자의 발악!!!!!!!

    티스토리툴바