WKWebView not loading webpage - renders blank screen in Swift

后端 未结 5 1866
渐次进展
渐次进展 2020-12-11 00:48

This code is supposed to load the Apple homepage, but instead shows a blank screen.
This happens with both HTTP and HTTPS URLs.

Code:

import UIK         


        
5条回答
  •  死守一世寂寞
    2020-12-11 01:42

    I have found the solution. The problem was being caused by AVG AntiVirus's webshield. For some reason AVG webshield treats all network communication from the simulator as fraudulent. The following screenshot shows the safari app running on simulator. It says that www.apple.com is not safe or any other website.

    The following screenshot is from system.log showing errors with webkit.

    You can replicate this problem by installing AVG antivirus and turning on the webshield. WKWebview in your App(On the simulator) wouldn't load anything.

    I don't understand why it wasn't working on an actual device tho. It could have been another problem with the device. I also deleted the derived data folder, the actual app and had restarted the device.

    Thank you everybody for the answers and help.

提交回复
热议问题