Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17458] iOS: ApplicationSupportDirectory is not created when analytics are disabled

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2015-03-16T16:37:29.000+0000
Affected Version/sn/a
Fix Version/sRelease 4.1.0
ComponentsiOS
Labelsn/a
ReporterIngo Muschenetz
AssigneePedro Enrique
Created2014-08-06T00:10:30.000+0000
Updated2017-03-23T22:26:28.000+0000

Description

Steps to reproduce:

Create a new Titanium application

Disable analytics is tiapp.xml

Attempt to write to the Ti.Filesystem.getApplicationSupportDirectory(). It will fail (as the directory does not exist).

Another way to confirm:
var self = Ti.Filesystem.getApplicationSupportDirectory();
console.log(self);
[INFO]  file:///Users/stephenfeather/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/1E1EB9EC-2997-4FD2-8618-41E5EA522A54/Library/Application%20Support/
Immediate workaround is to create that folder manually, but it should be created automatically.

Comments

  1. Ben Bahrenburg 2015-03-15

    PR provided to create directory after boot in TiApp PR: https://github.com/appcelerator/titanium_mobile/pull/6729 Test : https://gist.github.com/benbahrenburg/9adb20ded6e2fe218a11
  2. Pedro Enrique 2015-03-16

    Test code:
       var dir = Ti.Filesystem.getApplicationSupportDirectory(); 
       console.log(dir); 
       var f = Titanium.Filesystem.getFile(Ti.Filesystem.applicationSupportDirectory);
       console.log('Directory Exists: '+ (f.exists() ? 'Yes' : 'No'));
       console.log('Needs to be yes to pass'));
        
       var testfile = Ti.Filesystem.getFile(Ti.Filesystem.applicationSupportDirectory, 'text.txt');
       if(testfile.exists()){
       	testfile.deleteFile();
       }
        
       testfile.write("text written via write()\n");
       console.log("Check file at:" + testfile.nativePath);
       console.log('content needs to be there to pass'));
       
    Steps to verify 1. Create a new ti project 2. Before compiling turn off analytics 4. Create a new app and paste the code
  3. Lee Morris 2017-03-23

    Closing as fixed.

JSON Source