2

I am integrating WKWebView as a sub-view of another View Controller to show the conversations between two persons and able to do for normal text conversations.

But, the problem is we are not able to load the images from documents directory of the application into html using the url(file:///var/mobile/Containers/Data/Application/CFA85E42-7526-447D-81CD-4C86D3A3D3D6/Documents/2C29699C-994F-4860-8785-8015E9E4BBB9.jpeg) inside the webkit web view.

wkWebView.loadFileURL("file:///var/mobile/Containers/Bundle/Application/756EF089-4B8B-4F86-B834-9DFB8532A030/oneChat.app/www/index.html", allowingReadAccessToURL:"file:///var/mobile/Containers/Bundle/Application/0DDD77E6-2B05-4D99-AD9D-114F53B565A2/oneChat.app/")

Could anyone please help to solve this issue.

Mihriban Minaz
  • 3,043
  • 2
  • 32
  • 52
Krish Lakshmanan
  • 760
  • 7
  • 13
  • try relative paths. iOS may be preventing the full paths because of permissions. – ishaq Feb 01 '16 at 15:31
  • Hi @ishaq, Even with the relative path it adds those values automatically. And throws an error of Failed to load resources in the console of WKWebView. – Krish Lakshmanan Feb 02 '16 at 04:42
  • If I add a relative path, it tries to add accessUrl(app's bundle's resource path) as basUrl to the relative path. But those files are belongs to the Documents directory of the application. And all my css, other js files are belongs to the www directory of app's bundle path. – Krish Lakshmanan Feb 02 '16 at 04:57

0 Answers0