MapServer does not load from WKWebView but works in both UIWebView and Safari

07-10-2020 03:29 PM
New Contributor II


I have an application that needs to use WKWebView to display a map. This is a requirement from Apple as UIWebView will be deprecated by the end of this year.

In both UIWebView and Safari, the website with a map gets displayed correctly  but in the WKWebView the following call generates an error: 

"An error occurred trying to load the resource".

As result, the map is never displayed.

Has anyone experienced this issue?


0 Kudos
3 Replies
New Contributor II

I modified my app to point to the following site in esri:

the app using WKWebView fails to display the sample map.

However, if I use safari in the iPad simulator the same page displays the sample map without trouble.

Here it is with WKWebView:

esri sample map does not display in WKWebview

The same page displays just fine in the iPad simulator safari browser:

esri sample map displays in safari

Anybody else has this issue?

0 Kudos
New Contributor


I have the same problem.

I get the following error running it on my iPad "Request header field Cache-Control is not allowed by Access-Control-Allow-Headers".

Have you found a solution to the problem?



0 Kudos
New Contributor II

Hi Kasper,

The error we were facing was related to the handling of self signed certificates in the didReceiveAuthenticationChallenge method. Basically, we were cancelling all requests if they didn't match one of our host domains. Instead we needed to call PerformDefaultHandling in the completionHandler.

I think your issue is different... it sounds like the server side needs to change to allow Cache-Control in your Access-Control-Allow-Headers setting.