{ "id": "135949", "key": "TIMOB-17582", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "16586", "description": "Release 3.4.2", "name": "Release 3.4.2", "archived": false, "released": true, "releaseDate": "2017-03-11" }, { "id": "16704", "description": "Release 3.5.0", "name": "Release 3.5.0", "archived": false, "released": true, "releaseDate": "2015-01-13" }, { "id": "16593", "description": "Release 4.0.0", "name": "Release 4.0.0", "archived": false, "released": true, "releaseDate": "2015-05-21" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2014-11-27T07:15:21.000+0000", "created": "2014-09-01T12:54:54.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "module_filesystem", "qe-manualtest" ], "versions": [], "issuelinks": [ { "id": "44292", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "141895", "key": "TIMOB-18262", "fields": { "summary": "iOS: Cannot load images from the applicationDataDirectory", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2014-12-19T16:36:16.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "h6.Issue description\r\nNot 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. \r\n\r\nh6.Steps to replicate \r\n1) Please grab the sample attached \"CaseClassic2559.zip\" and launch at iOS Simulator (for Alloy, you may want to use \"Case2559.zip\").\r\n2) 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.\r\n\r\nh6.Additional details\r\nAlloy 1.4.1 - iPad OS 7.0.4. Also on TiSDK 3.4.0 CI and Alloy 1.6.0-dev.", "attachment": [ { "id": "50910", "filename": "Case2559.zip", "author": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-09-01T12:54:54.000+0000", "size": 5919590, "mimeType": "application/zip" }, { "id": "50911", "filename": "CaseClassic2559.zip", "author": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-09-01T12:54:54.000+0000", "size": 3139694, "mimeType": "application/zip" } ], "flagged": false, "summary": "iOS: Unable to check if a JS source file exists on iPad device", "creator": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "environment": "iOS 7.1 & iOS 8 (Beta 6)\r\nTi SDKs: 3.2.1, 3.2.3, 3.3.0", "closedSprints": [ { "id": 241, "state": "closed", "name": "2014 Sprint 22 SDK", "startDate": "2014-10-27T22:25:43.407Z", "endDate": "2014-11-08T01:00:00.000Z", "completeDate": "2014-11-10T20:10:00.899Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "321471", "author": { "name": "jrhinehart", "key": "jrhinehart", "displayName": "Joshua Rhinehart", "active": true, "timeZone": "America/Los_Angeles" }, "body": "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.", "updateAuthor": { "name": "jrhinehart", "key": "jrhinehart", "displayName": "Joshua Rhinehart", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-09-02T23:14:13.000+0000", "updated": "2014-09-02T23:14:13.000+0000" }, { "id": "321564", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Is there a way we can just past the sample directly in the ticket? I don't think we need all the supporting files.", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-09-03T13:32:07.000+0000", "updated": "2014-09-03T13:32:07.000+0000" }, { "id": "321654", "author": { "name": "jrhinehart", "key": "jrhinehart", "displayName": "Joshua Rhinehart", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The Alloy index.js is as follows: \r\n{code}var createController = Alloy.createController;\r\n\r\n/**\r\n * Override the Alloy createController method.\r\n * \r\n * Prepends 'ipad/' to the controller name if the controller exist in the ipad folder\r\n */\r\nAlloy.createController = function(name, args) {\r\n var osname = Ti.Platform.osname;\r\n alert(osname);\r\n var controllerPath = Ti.Filesystem.resourcesDirectory + 'alloy/controllers/';\r\n // search controller in the os name folder\r\n var controllerName = osname + '/' + name;\r\n var file = Ti.Filesystem.getFile(controllerPath, controllerName + '.js');\r\n Ti.API.log(file.name);\r\n // load the controller in the platform folder if found, other load the default\r\n if (file.exists()) {\r\n name = controllerName;\r\n }\r\n \r\n Ti.API.log(controllerPath);\r\n Titanium.API.log('Controller Name: ' + name);\r\n return createController(name, args);\r\n};\r\n\r\n/**\r\n * Loads \"ipad/HelloWorld.js\" for ipad, and \"HelloWorld.js\" for other devices\r\n */\r\nvar controllerName = 'HelloWorld';\r\nvar label = Alloy.createController(controllerName).getView();\r\n\r\n$.index.add(label);\r\n$.index.open();{code}\r\n\r\nand the corresponding app.js from the classic project is here: \r\n{code}var getController = function(name) {\r\n var osname = Ti.Platform.osname;\r\n if(osname == 'ipad'){\r\n \tname = 'HelloWorld';\r\n \tTi.API.info('iPad this time');\r\n }\r\n var controllerPath = Ti.Filesystem.resourcesDirectory + 'alloy/controllers/';\r\n // search controller in the os name folder\r\n var controllerName = osname + '/' + name;\r\n var file = Ti.Filesystem.getFile(controllerPath, controllerName + '.js');\r\n Ti.API.info(name +' controllerPath + controllerName: '+ controllerPath + controllerName );\r\n // load the controller in the platform folder if found, other load the default\r\n //if (file.exists()) {\r\n name = controllerName;\r\n Ti.API.info('file.nativePath: '+ file.nativePath);\r\n return require('alloy/controllers/' + controllerName).HelloWorld();\r\n // }else{\r\n \t// Titanium.API.log('Controller Name: ' + controllerName);\r\n \t// return require('alloy/controllers/' + controllerName).HelloWorld(); \t\r\n // }\r\n \r\n};\r\n\r\n/**\r\n * Loads \"ipad/HelloWorld.js\" for ipad, and \"HelloWorld.js\" for other devices\r\n */\r\nvar controllerName = 'HelloWorld';\r\nvar label = getController(controllerName);\r\n\r\nwin1.add(label);\r\n\r\nwin1.open();{code}", "updateAuthor": { "name": "jrhinehart", "key": "jrhinehart", "displayName": "Joshua Rhinehart", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-09-03T21:16:58.000+0000", "updated": "2014-09-03T21:17:46.000+0000" }, { "id": "327998", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "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.\r\nBy doing so, the resourcesDirectory returned reliable results for devices and simulators.\r\n\r\nPR here: https://github.com/appcelerator/titanium_mobile/pull/6213\r\n", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-10-14T09:22:10.000+0000", "updated": "2014-10-14T09:22:10.000+0000" }, { "id": "330615", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "PR's merged\r\nmaster - https://github.com/appcelerator/titanium_mobile/pull/6300\r\n3_4_X - https://github.com/appcelerator/titanium_mobile/pull/6301", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-11-03T21:53:06.000+0000", "updated": "2014-11-03T21:53:06.000+0000" }, { "id": "333835", "author": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The correct js source file path is evaluated/fetched for both iPad simulator and device.\r\nVerified on:\r\nSDK: 3.5.0.v20141125154115\r\nStudio: 3.4.1.201410281743\r\nCLI: 3.4.1\r\nAlloy: 1.5.1\r\nDevice: iPad simulator (8.1), iPad 2(v7.1.2), ipad 4(v8.0)\r\nXcode: 6.1", "updateAuthor": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-11-26T07:45:44.000+0000", "updated": "2014-11-26T07:45:44.000+0000" } ], "maxResults": 9, "total": 9, "startAt": 0 } } }