Swift – WebView unable to load http pages

I think Apple did some changes to the later versions of Xcode. If you have used WebView in Xcode 6 with iOS 8, you were probably able to load http pages just fine. With Xcode 7 and iOS 9 you can only load https files by default. Apple thinks this is a security settings. And you need to change this to be able to load http pages. It it just a small change you need to do.

How to fix WebView unable to load http pages:
– In your Xcode project, open the info.plist file in the Project Navigator.
– Right click somewhere under the key list, and select “Add row”.
– Name the key: App Transport Security Settings
– And as key type select Dictionary.
– Click the arrow before the key name.
– Then click the plus sign behind the key name.
– And name the sub key: Allow Arbitrary Loads
– Make the sub key a Boolean, and value should be YES

WebView unable to load http pages

 

 

Now your App should be able to load http pages, and not just https pages.

That is it really.

If you still get WebView unable to load http pages. Or is unsure how to do it. You can download my example project from github here: https://github.com/solron/webrequest-test

Happy surfing!

About Author

Related Posts

Xcode 9 iOS icon sizes

Xcode 9 iOS icon sizes overview

Xcode 9 iOS icon sizes overview Xcode 9 iOS icon sizes overview. They keep adding more and more icon sizes. Xcode 9 has the most icon sizes…

Xcode 9 uiimage image not shown

Xcode 9 uiimage image not shown

Xcode 9 uiimage image not shown Working on some ios apps created with Xcode 8 and your images don’t show after upgrading to Xcode 9? Took me awhile…

Xcode 8 iOS icon sizes overview

Xcode 8 iOS icon sizes overview Xcode 8 iOS icon sizes overview. There are even more icon sizes since Xcode 7. And it can be an extra challenging…

Swift Capitalize

Swift Capitalize words, How to

Swift Capitalize, How to Swift Capitalize is done with a string instance property. Check the example below to see how to use it. There is also a link…

Swift Debian

Swift Debian 8 (Jessie)

Swift Debian 8 (Jessie) Swift, Apples new programming language, to take over for Objective C has been open source for some time now. It only took at…

didMove never get called

Xcode – didMove never get called

didMove never get called in Xcode? didMove never get called when creating a new project with Xcode using the Game template. I selected Swift and SpriteKit. I…

Leave a Reply