[AC-6321] iOS WebView won't read files from applicationDataDirectory
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | n/a |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2019-12-27T15:54:27.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | Titanium SDK & CLI |
| Labels | webView |
| Reporter | Ace McLoud |
| Assignee | Motiur Rahman |
| Created | 2019-07-25T10:30:15.000+0000 |
| Updated | 2019-12-27T15:54:27.000+0000 |
Description
Apparently WebViews on iOS devices can't read files from the applicationDataDirectory.
The code below takes a file from the resourcesDirectory, writes the content to a new file in applicationDataDirectory and passes its nativePath to a WebView for display.
This works on Android devices and emulator, as well as in iOS Simulator.
This used to work on iOS devices before SDK Release 8.0.0
$.index.open();
var testhtml = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, "test.html");
testhtml.write(String(Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, "test.html").read()));
var f = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, "test.html");
$.webview.url = f.nativePath;
Attachments
| File | Date | Size |
|---|---|---|
| index.js | 2019-07-25T10:28:59.000+0000 | 322 |
| index.xml | 2019-07-25T10:29:14.000+0000 | 177 |
| test.html | 2019-07-25T10:28:54.000+0000 | 307 |
[~AceMcLoud] Please see TIMOB-27159. It looks duplicate of this. Thanks!
Hello [~AceMcLoud], The issue will be solved in the 8.2.0.GA release. Right now, we will keep this ticket open as a duplicate. We will update you once the 8.2.0 GA release is available. Thanks.
Hello [~AceMcLoud], Can you please follow up the status of the issue in SDK 8.2.0.GA? Thanks.
[~AceMcLoud] I see it works as expected with TI SDK 8.2.0.GA and later version. Thanks!