GitHub Issue | n/a |
Type | Bug |
Priority | n/a |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Release 8.0.0, Release 8.2.0 |
Fix Version/s | n/a |
Components | n/a |
Labels | applicationDataDirectory, engSchedule, iOS, webview |
Reporter | Jignesh Kasundra |
Assignee | Eric Merriman |
Created | 2019-07-23T08:58:33.000+0000 |
Updated | 2020-02-27T12:38:30.000+0000 |
On iPhone device (iOS 12.3.1) the image file is not getting loaded into webview from iPhone storage (applicationDataDirectory). It works on simulator 12.1
please check the attached sample test case
[~jignesh.igp] It looks duplicate of TIMOB-27159. Can you verify once with [PR](https://github.com/appcelerator/titanium_mobile/pull/10976).
It is not recommended to have local HTML and resource files in different folders. The
assetsDirectory
option introduced in TIMOB-27159 probably could solve this issue but you can avoid it in the first place by just having everything in the same directory. For example, copy the HTML/JS toTi.Filesystem.applicationDataDirectory
as well and change thesrc
property in your HTML file to the correct relative path. The directory structure should look something like this based on your provided test case:Then you can easily reference the images via
downloaded_images/test.jpg
.Thanks! Jan Vennemann Our actual problem is, we have e-learning base app that have dynamic content (css , images ,js) need to present in webview which we are downloading from server and storing it into the iPhone storage (Ti.Filesystem.applicationDataDirectory) and loading it to webview. Where for webview presentation & layout we have static files (index.html, css , images , js) that we kept it under app Resource directory so the webview uses both directory. The storage directory access in webview is working fine with Titanium SDK 7.4.1 on iPhone Device (Latest iOS 12.3.1 version) but not from Titanium SDK 8.X.X updates and onwards
Yes, unfortunately that is a breaking change in 8.0.0 when we moved to WKWebView internally. The workaround from my previous comment should also be easily implemented for your use case. Just copy the relevant files from the resources directory to the data directory on first app launch or whenever you update the app. Then you will have everything in the same place and do not run into these limitations.
Thanks as you suggested. We have tested the workaround to place everything in one place ( html, image) but still the file is not loading into webview from applicationDataDirectory (Device) Please find the attached test example (Resources2.zip [^Resources2.zip] )
[~jignesh.igp], thanks for providing an example. The
setHtml
methods still seems to have some issues with resolving relative paths. [~vijaysingh], can you take a look at this? UsingsetHtml
with thebaseURL
option fails to load local resources even when using the fix from TIMOB-27159.Hello. is there any work-around to fix the issue ? i am not able to load local files JGP , JS ..etc under the webview from Phone Storage applicationDataDirectory checked on Release 8.3.1 but it's not working.