WKWebView using Simulator: Error Code -1200 - An SSL error has occurred and a secure connection to the server cannot be made

In both situations below I'm successfully connected to WiFi. Using Safari and Chrome (I have a VPN on chrome) with my mac I can successfully connect to google, apple, and youtube.

When I use an actual device to connect to any website using WKWebView everything works fine.

But when I try to connect to any website (including google, apple, and youtube) using WKWebView and the simulator I get this error.

func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {

    let code = error._code
    print(code) // prints 1200

    print(error.localizedDescription)) // An SSL error has occurred and a secure connection to the server cannot be made
}

Why can I successfully connect using a real device but not the simulator? Btw this just started happening today. It never happened before and I didn't change any Xcode settings.

I found an answer that said in the simulator go to Settings > Developer > Allow HTTP Services and to toggle it on. It still doesn't work wether on or off.

I also tried this which works fine on a real device using WKWebView

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

But on the simulator using WKWebView the website still doesn't show and I get the error:

The certificate for this server is invalid. You might be connecting to a server that is pretending to be "wwwgoogle.com" which could put your confidential information at risk.

The bottom error is actually www.google.com. I didn't add the first dot after www because it wouldn't let me post it using the entire web address. It said "Please fix the following URL related errors ..."

The answer that I thought worked didn't work.

WKWebView using Simulator: Error Code -1200 - An SSL error has occurred and a secure connection to the server cannot be made
 
 
Q