0
votes

In my iOS App upon clicking a button, i am calling an API and getting a URL string as response. Next i load that URL in a WKWebView using loadrequest. Now

  1. The initial page loads and further redirects happen
  2. Two times didstartprovisionalnavigation and didendprovisonalnavigation delegate methods are called.
  3. Both response code is 200
  4. Finally i am seeing a blank page . There is no entry in DidFailProvisionalNavigation method .

Upon calling the url in the webview, there is a server side processing , authentication with OKTA is done , and we get final response as a webpage for example, https://www.compname.com/file .

This loads in browsers safari , chrome also in ios simulator browser but not in wkwebview.

I have set Arbitary loads key to YES , there is a intermediate page that displays correctly upon completing the first request . Next redirection / internal requests results in blank page with response code as 200 .

EDIT : Also this URL loads well in SFSafariviewController

Am i missing any session maintenance ? since two times requests loads and finishes ? Kindly help

1

1 Answers

0
votes

When loading an url request in WKWebView you need to specify the scheme (http/https) in the url as well.

So the url should be like this:

let url = URL(string: "http://www.compname.com/file")