LoginSignup
0
0

More than 5 years have passed since last update.

System.Net.WebException - App Transport Security policy requiresが出た時の対処

Last updated at Posted at 2018-08-25

Xamarin.iOSでHttpClinetを使った時に、System.Net.WebExceptionが発生するようになってしまった。前はhttpでもいけたと思ったんだけど、httpsじゃないとダメみたい。
System.Net.WebException.png

stack overflowにXcode用の解決方法があった

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

Xamarinで試したところうまくいった

  1. Visual Studio>プロジェクトツリー>info.plist>ソースを開く
  2. 新しいエントリの追加で、NSAppTransportSecurity(辞書型)を追加
  3. 追加されたエントリの下に、NSAllowsArbitraryLoads(ブール値)を追加し、値を「Yes」にする。
  • 設定例 - Visual Studio for Mac v7.6.1(build 9) info-plist.png

リビルドして実行すれば、httpsで通信できるようになる。

0
0
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
0
0