LoginSignup
8
3

More than 5 years have passed since last update.

ATSを無効にしてもhttps接続ができない(TLS1.0)

Posted at

ATSを無効にしているにも関わらず、SSL関連のエラーでサーバーに接続できない場合がありました。

問題の発生要因

接続先サーバーが TLS 1.0 になっている(と思われます、たぶん)

問題の発生する条件

iOS8,9でURLSessionを使うと発生します。
WebViewを使用する場合、またiOS10のURLSessionは問題ありません。

WebView URLSession
iOS8 OK NG
iOS9 OK NG
iOS10 OK OK

対策

必ず TLS 1.0 で通信するように設定します。

let configuration = URLSessionConfiguration.ephemeral
configuration.tlsMaximumSupportedProtocol = .tlsProtocol1
configuration.tlsMinimumSupportedProtocol = .tlsProtocol1

let session = URLSession(configuration: configuration)

WebViewとiOS10のURLSessionは、
TLS 1.2 => TLS 1.1 => TLS 1.0
と順番に通信してくれているものの、
iOS8,9のURLSessionはそのような処理がされておらずエラーになるようです。

8
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
3