When loading an HTML string to a WebView via its "html" property, it is no longer able to access the app's local files under the "Resources" directory as of Titanium 8.0.0.RC.
Steps to reproduce:
- Create a Classic "Default Project" app.
- Replace the "app.js" code with the below code.
- Build with Titanium 8.0.0 and run on iOS.
- Notice that an image failed to load within the web view.
- Build with Titanium 7.5.x and run on iOS.
- Notice that the image successfully loaded within the web view.
Loading local resource files via app://Resources/ also fails to load on iOS in Titanium 8.0.0.RC, but worked in older versions. Note that this URL scheme is undocumented and is not supported on Android.
On iOS, the WebView.setHtml() method supports a 2nd argument where you can provide a "baseURL" parameter. This parameter allows you to set the directory (or URL) that file paths should be relative to. So, the below will work-around the problem.
Original Bug Report Below
The upcoming change in 8.0 from UIWebView to WKWebView is major and because of my reliance on the WebView I wanted to start testing this. There is a ticket
TIMOB-26095 that indicates the transition is complete and tested, but there are so many use cases that are not included in the sample tests provided that I have major concerns.
For example, I cannot get local resources like images to be rendered inside the WebView.
Works fine in SDK 7.5.1, but the image does not load in 8.0.
Am I doing something wrong? Is there a low-level change that I should know about for this?