Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26217] iOS: File methods isFile() and isDirectory() are missing for encrypted assets

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2018-09-19T21:35:07.000+0000
Affected Version/sn/a
Fix Version/sRelease 7.5.0
ComponentsiOS
Labelsfile, ios, parity
ReporterJoshua Quick
AssigneeJoshua Quick
Created2018-07-18T02:16:15.000+0000
Updated2018-10-03T18:39:39.000+0000

Description

*Summary:* On iOS, when loading an encrypted asset such as "app.js" via Ti.Filesystem.getFile(), the returned File object is missing methods isFile() and isDirectory(). Attempting to call these methods will cause JavaScript runtime error. This is an issue for iOS "production" builds and "test" builds for device. This is not an issue for iOS Simulator builds since JS files are not encrypted. This is not an issue on Android. *Steps to reproduce:*

Create a Titanium project with the below code.

Build and run to an iOS device.

Notice that the app crashes on startup.

Build and run to the iOS simulator.

The isFile() and isDirectory() methods work and are correctly logged.

var file = Ti.Filesystem.getFile("app.js");
Ti.API.info("@@@ app.js isFile(): " + file.isFile());
Ti.API.info("@@@ app.js isDirectory(): " + file.isDirectory());
*Cause:* Our TiFileSystemBlobProxy.m code is missing the isFile() and isDirectory() methods.

Comments

  1. Joshua Quick 2018-07-18

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/10112
  2. Joshua Quick 2018-07-18

    The diff can be found here... https://github.com/appcelerator/titanium_mobile/pull/10112/commits/afc75ad2a229f11a5febbaa48edff2697b484a4c
  3. Hans Knöchel 2018-07-18

    While I would rather want to see this in an own PR, I think it's okay to do it as part of TIMOB-26015.
  4. Lokesh Choudhary 2018-09-19

    FR Passed. The returned File object is contains methods isFile() and isDirectory() for both production & test builds. Studio Ver: 5.1.1.201809051655 SDK Ver: 7.5.0 local build OS Ver: 10.13.5 Xcode Ver: Xcode 9.4.1 Appc NPM: 4.2.13 Appc CLI: 7.0.6 Daemon Ver: 1.1.3 Ti CLI Ver: 5.1.1 Alloy Ver: 1.13.2 Node Ver: 8.9.1 NPM Ver: 5.5.1 Java Ver: 10.0.2 Device: Iphone 7 IOS 11.4 Simulator: Iphone 8 IOS 11.4
  5. Lokesh Choudhary 2018-09-19

    PR Merged.
  6. Keerthi Mahalingam 2018-10-03

    Verified the fix on sdk 7.5.0.v20181003071100.No crash on start up. isFile() and isDirectory() method works fine and logged correctly. Closing.
       Operating System
         Name                        = Mac OS X
         Version                     = 10.13.6
         Architecture                = 64bit
       Node.js
         Node.js Version             = 8.9.1
         npm Version                 = 5.5.1
       Titanium CLI
         CLI Version                 = 5.1.1
       Titanium SDK
         SDK Version                 =7.5.0.v20181003071100
       Device			      = iPhone 6s -ios 12 
       			             iPhone 6 plus-ios 11 simulator
       

JSON Source