[TIMOB-17582] iOS: Unable to check if a JS source file exists on iPad device
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-11-27T07:15:21.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 3.4.2, Release 3.5.0, Release 4.0.0 |
Components | iOS |
Labels | module_filesystem, qe-manualtest |
Reporter | Eduardo Gomez |
Assignee | Chee Kiat Ng |
Created | 2014-09-01T12:54:54.000+0000 |
Updated | 2014-12-19T16:36:16.000+0000 |
Description
Issue description
Not able to check if a JS source file exists in the app. It only worked in the iOS simulator but not the ipad device. This was initially reproduced on Alloy but attached is a Classic app sample.Steps to replicate
1) Please grab the sample attached "CaseClassic2559.zip" and launch at iOS Simulator (for Alloy, you may want to use "Case2559.zip"). 2) Notice when compiled in the iOS ipad simulator, you will see "I'm Ipad". But it will show "This is Not Ipad" in the real ipad device.Additional details
Alloy 1.4.1 - iPad OS 7.0.4. Also on TiSDK 3.4.0 CI and Alloy 1.6.0-dev.Attachments
File | Date | Size |
---|---|---|
Case2559.zip | 2014-09-01T12:54:54.000+0000 | 5919590 |
CaseClassic2559.zip | 2014-09-01T12:54:54.000+0000 | 3139694 |
The sample works on Simulator, but the file.exists() call fails on device. If you pull the name = controllerName; out of the if loop, it works as expected.
Is there a way we can just past the sample directly in the ticket? I don't think we need all the supporting files.
The Alloy index.js is as follows:
and the corresponding app.js from the classic project is here:
It is discovered that resourcesDirectory doesn't return a reliable result when utilized on iPad devices specifically. After some investigation, it is due to the use of [[NSBundle mainBundle] bundlePath]. Instead of absoluteString, path is recommended to be used when obtaining the path string for NSFileManager according to apple docs. By doing so, the resourcesDirectory returned reliable results for devices and simulators. PR here: https://github.com/appcelerator/titanium_mobile/pull/6213
PR's merged master - https://github.com/appcelerator/titanium_mobile/pull/6300 3_4_X - https://github.com/appcelerator/titanium_mobile/pull/6301
The correct js source file path is evaluated/fetched for both iPad simulator and device. Verified on: SDK: 3.5.0.v20141125154115 Studio: 3.4.1.201410281743 CLI: 3.4.1 Alloy: 1.5.1 Device: iPad simulator (8.1), iPad 2(v7.1.2), ipad 4(v8.0) Xcode: 6.1