4

In our app we are using readium library SDK to load epub file. WKWebview could not be load epub file because epub has been downloaded from server and saved in document path.

WKwebview has issue with accessing that file.

Note :- Same is working in simulator but not in the real device.

Below is the console log :

Received an unexpected URL from the web process: 'file:///var/mobile/Containers/Data/Application/C2D90ACC-D0C9-4D52-A4C8-B6EB7181DB9E/Documents/Books/81004325324010/C8FFB99F71D319A460F954F2C12EA296/content/2aabc318-3199-4275-aed2-e7fbf57d626e/OEBPS/Text/cover.htm' 2020-01-23 20:13:27.800321+0530 Papyrus[819:168410] [Process] 0x102130c18 - WebPageProxy::Ignoring request to load this main resource because it is outside the sandbox 2020-01-23 20:13:27.800395+0530 Papyrus[819:168410] [Process] kill() returned unexpected error 1

file path which is not loading in simulator debugger screenshot in device debugger screenshot

Kanagaraj
  • 51
  • 3

1 Answers1

0

It is a permission issue, maybe a bug of WKWebView but the below steps are working for me.

[1] Get access,
Call loadFileURL function with base path URL where require access.
open func loadFileURL(_ URL: URL, allowingReadAccessTo readAccessURL: URL) -> WKNavigation?

[2] Load your HTML content,
Call loadHTMLString function after loadFileURL function with same base path URL to load content.
open func loadHTMLString(_ string: String, baseURL: URL?) -> WKNavigation?

ham118
  • 31
  • 4