Titanium JIRA Archive
Appcelerator Community (AC)

[AC-6321] iOS WebView won't read files from applicationDataDirectory

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionFixed
Resolution Date2019-12-27T15:54:27.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
LabelswebView
ReporterAce McLoud
AssigneeMotiur Rahman
Created2019-07-25T10:30:15.000+0000
Updated2019-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

FileDateSize
index.js2019-07-25T10:28:59.000+0000322
index.xml2019-07-25T10:29:14.000+0000177
test.html2019-07-25T10:28:54.000+0000307

Comments

  1. Vijay Singh 2019-08-08

    [~AceMcLoud] Please see TIMOB-27159. It looks duplicate of this. Thanks!
  2. Sharif AbuDarda 2019-08-23

    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.
  3. Sharif AbuDarda 2019-09-27

    Hello [~AceMcLoud], Can you please follow up the status of the issue in SDK 8.2.0.GA? Thanks.
  4. Motiur Rahman 2019-12-27

    [~AceMcLoud] I see it works as expected with TI SDK 8.2.0.GA and later version. Thanks!

JSON Source