iOS WkWebview Return A Blank Screen / White Screen

Try to code your first example of WkWebview / UIWebView in your iOS app always return a blank screen or white screen? You are not alone. Apparently since iOS 9, all HTTP / non-secure web connection is block by default. It is something call App Transport Security (ATS).

You can add the following configuration into Info.plist to allow WkWebview / UIWebView to load HTTP / non-secure web page:

<key>NSAppTransportSecurity</key>
<dict>
    <key> NSAllowsArbitraryLoadsInWebContent</key>
    <true/>
</dict>

Or you can completely disable App Transport Security by

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

Source: https://developer.xamarin.com/guides/ios/application_fundamentals/ats/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s