0

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.

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 "www.google.com" which could put your confidential information at risk.
Lance Samaria
  • 17,576
  • 18
  • 108
  • 256
  • Have you configured proxy or VPN on your's macbook? Try open same link from safari – Cy-4AH Feb 10 '22 at 11:55
  • @Cy-4AH hi, thanks for the response. No I don’t have a proxy but I do use a VPV but only on Chrome. When I use Safari there isn’t a VPN. But using my Mac I can connect to google using Chrome and Safari. On that same exact mac, using the simulator I can’t connect to google or YouTube or Apple. – Lance Samaria Feb 10 '22 at 12:21

0 Answers0