0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Xcode7でApp Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. と怒られたときの対処法

Posted at

動作環境

Xcode 7.1.1
Mac OS X Yosemite 10.10.5

現象

通信を行うアプリをビルドすると、下記のように怒られてしまう。

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.

自分の場合、ローカルで立ち上げていたAPI
http://localhost:3000/hogehogeapi/
を叩きにいったとき、上記エラーとなりました。

原因

どうやらiOS9からhttps通信推奨となり、http通信でのリクエストがはじかれてしまう模様。

対処法

info.plistを編集し、App Transport Security(APS)を無効にする。

  • NSAppTransportSecurityをDictionaryで追加
  • その下位にNSAllowsArbitraryLoads をBooleanで追加
  • NSAllowsArbitraryLoadsのvalueをYESに設定

下記参考サイトで図解されていますので、参考にしてください。

参考:http://d.hatena.ne.jp/kazukingband/20150910/1441875442

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?