I have few pdf files at firebase server that i need to show to the users in the app. But the problem is, it doesn't show the pdf files neither in webview nor in WKWebView. I tried the following code snippets but neither worked.
if let url = URL(string: urlString){
// First Approach
if let data = try? Data(contentsOf: url) {
webView.load(data, mimeType: "application/pdf", characterEncodingName: "", baseURL: url)
}
// Second Approach
let req = URLRequest(url: url)
self.webView.load(req)
}
Here is one of the urls. Pdf file
I used the PDFKit as well but that also didn't work. Here is the log when i try to load it into webview.
2020-05-21 21:06:01.561593+0500 Mini Muslims[41242:748632] WF: _WebFilterIsActive returning: NO
2020-05-21 21:06:10.383853+0500 Mini Muslims[41242:748632] WF: _userSettingsForUser : (null)
2020-05-21 21:06:10.384063+0500 Mini Muslims[41242:748632] WF: _WebFilterIsActive returning: NO
2020-05-21 21:06:13.050745+0500 Mini Muslims[41242:748634] Task <5CBC8251-89EC-4DCD-A9A0-E794B3AEB6EC>.<0> HTTP load failed, 0/0 bytes (error code: -999 [1:89])
2020-05-21 21:06:18.123494+0500 Mini Muslims[41242:748632] WF: _userSettingsForUser : (null)
2020-05-21 21:06:18.123672+0500 Mini Muslims[41242:748632] WF: _WebFilterIsActive returning: NO
2020-05-21 21:06:18.173099+0500 Mini Muslims[41242:748632] WF: _userSettingsForUser : (null)
2020-05-21 21:06:18.173315+0500 Mini Muslims[41242:748632] WF: _WebFilterIsActive returning: NO
2020-05-21 21:06:19.260676+0500 Mini Muslims[41242:748632] WF: _userSettingsForUser : (null)
2020-05-21 21:06:19.260878+0500 Mini Muslims[41242:748632] WF: _WebFilterIsActive returning: NO
2020-05-21 21:06:22.607212+0500 Mini Muslims[41242:748632] WF: _userSettingsForUser : (null)
2020-05-21 21:06:22.607351+0500 Mini Muslims[41242:748632] WF: _WebFilterIsActive returning: NO
2020-05-21 21:06:23.080709+0500 Mini Muslims[41242:748632] WF: _userSettingsForUser : (null)
2020-05-21 21:06:23.080916+0500 Mini Muslims[41242:748632] WF: _WebFilterIsActive returning: NO
2020-05-21 21:06:28.736644+0500 Mini Muslims[41242:748632] WF: _userSettingsForUser : (null)
2020-05-21 21:06:28.736875+0500 Mini Muslims[41242:748632] WF: _WebFilterIsActive returning: NO
2020-05-21 21:06:36.769000+0500 Mini Muslims[41242:748632] WF: _userSettingsForUser : (null)
2020-05-21 21:06:36.769220+0500 Mini Muslims[41242:748632] WF: _WebFilterIsActive returning: NO
The pdf never loads. What could be the possible issue. Please guide me so that i can resolve this issue.