2

I'm having trouble with WKWebView in XCode 7 using the iOS 9 sdk. For some reason, half of the websites I try to load come up blank (for example mobile Facebook).

WKWebView worked perfectly when I built my app on iOS 8. I haven't changed any of the code for loading webpages (I used loadrequest with a nsurl), and I know that the webviews are active because some links do load.

Is this a possible bug?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
user3796209
  • 449
  • 6
  • 18

1 Answers1

7

This might be related to a new feature called ATS (App Transport Security), which was introduced in iOS 9.

Please see: https://developer.apple.com/library/prerelease/ios/technotes/App-Transport-Security-Technote/

All connections using the NSURLConnection, CFURL, or NSURLSession APIs use App Transport Security default behavior in apps built for iOS 9.0 or later, and OS X 10.11 or later. Connections that do not follow the requirements will fail.

It is possible to add exceptions or to allow any non-secured connections. For example, you can add this to your Info.plist:

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitraryLoads</key>
  <true/>
</dict>
samsonthehero
  • 191
  • 3
  • 6