LoginSignup
1

More than 5 years have passed since last update.

posted at

UIWebViewやWKWebViewでウェブページがロードされない

UIWebViewやWKWebViewで正しいコードを入れているはずなのに、全くページがロードされず画面が真っ白。何が問題か分からず数時間ハマってしまいました。
以前(iOS8)では同じコードで問題なく動いていたのに・・・

原因はiOS9から導入されたApp Transport Securityでした。

上記のリンクのように、例外設定をしてあげるのが理想ですが、手っ取り早く動かしたいならinfo.plistの設定でApp Transport Securityをオフにしてあげるとひとまずウェブページがロードされるようになります。

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

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
What you can do with signing up
1