UIWebView not loading in iOS 10

2.5k Views Asked by At

After updating to iOS 10 and Swift 3 my webViews are not working. In the debug area is the following. It happens on device or in the simulator. Does anyone know what is causing this.

2017-05-23 20:04:19.453057-0500 AppName[394:32639] WF: _userSettingsForUser mobile: {
    filterBlacklist =     (
    );
    filterWhitelist =     (
    );
    restrictWeb = 1;
    useContentFilter = 0;
    useContentFilterOverrides = 0;
    whitelistEnabled = 0;
}
2017-05-23 20:04:19.453481-0500 AppName[394:32639] WF: _WebFilterIsActive returning: NO
2

There are 2 best solutions below

0
On

I was having the same problem when I try to play a vimeo video in a UIWebView in IOS 10. In my case I was setting the HTML of the UIWebView in viewDidLayoutSubviews().

        let htmlString:String! = "<iframe src=\"https://player.vimeo.com/video/7100569\" width=\"\(self.view.frame.width - 20)\" height=\"\(self.videoWebView.frame.height)\" frameborder=\"0\" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>"
        self.videoWebView.loadHTMLString(htmlString, baseURL: nil)

I solved the problem by putting this code in the viewDidLoad()

0
On

Forgot to update this. Well turns out the client converted to a Linux server and didn't think it would matter so never mentioned it. The folder where the files were located contained capitals but the code in the app did not. When using a Linux server if the files or folders contain capitals then the URL must as well. Quick fix I just moved the files to a new folder without capitals.