{ "id": "149601", "key": "TIMOB-19223", "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": [], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2016-11-02T11:43:31.000+0000", "created": "2015-07-10T07:37:38.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "ios" ], "versions": [], "issuelinks": [], "assignee": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-21T21:02:36.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": "In iOS\r\n{code:java}\r\nTi.API.info(\"Ti.Filesystem.File is \" + Ti.Filesystem.File);\r\n{code}\r\nreturns undefined, so you can not do something like\r\n{code:java}\r\n if ( url instanceof Ti.Filesystem.File )\r\n{code}\r\n\r\nIt works in Android.", "attachment": [], "flagged": false, "summary": "iOS: Ti.Filesystem.File is undefined", "creator": { "name": "angelf", "key": "angelf", "displayName": "Ángel Flores", "active": true, "timeZone": "Europe/Madrid" }, "subtasks": [], "reporter": { "name": "angelf", "key": "angelf", "displayName": "Ángel Flores", "active": true, "timeZone": "Europe/Madrid" }, "environment": "Appcelerator Studio\t4.1.0.201507071122-07072015112339\r\n", "comment": { "comments": [ { "id": "362623", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~angelf] Can you provide a more specific demo code? ", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-09-09T05:21:36.000+0000", "updated": "2015-09-09T05:21:36.000+0000" }, { "id": "362643", "author": { "name": "angelf", "key": "angelf", "displayName": "Ángel Flores", "active": true, "timeZone": "Europe/Madrid" }, "body": "Before downloading a file (e.g an image), I check if it is cached or not. In order to reuse code, this function is called even when 'url' is a file path in which case I return the file.\r\nWhen the file is not cached, I return a file object where the image must be downloaded (using the name in the url).\r\n\r\n\r\nexports.isInCache = function (url) {\r\n if(url instanceof Ti.Filesystem.File)//This is what I really use --> if(url.indexOf(\"file:///\")==0)\r\n {\r\n url=url.replace(/%20/g, \" \");\r\n return Ti.Filesystem.getFile(url);\r\n }\r\n\t\r\n\tvar filename = url.substring(url.lastIndexOf(\"/\")+ 1, url.length);\r\n\tfinalName= userFolder + filename;\r\n\t\r\n\tvar basePath = Titanium.Filesystem.applicationDataDirectory;\r\n f = Ti.Filesystem.getFile(basePath, finalName);\r\n\t\r\n\tif(!f && !f.exists())\r\n\t{\r\n\t\tvar t;\r\n\t\t//code to check if the file is in the external storage and create 'userFolder' if it is needed.\r\n\t}\r\n\treturn f;\r\n}\r\n", "updateAuthor": { "name": "angelf", "key": "angelf", "displayName": "Ángel Flores", "active": true, "timeZone": "Europe/Madrid" }, "created": "2015-09-09T09:40:32.000+0000", "updated": "2015-09-09T09:41:50.000+0000" }, { "id": "363634", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "As documented, you should call {{Ti.FileSystem.getFile()}}, can you try that? The Ti.Filesystem.File is not supposed to work without being associated to an url. Thank you!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-09-11T21:03:31.000+0000", "updated": "2015-09-11T21:03:31.000+0000" }, { "id": "400245", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "As said last year, the {{Ti.Filesystem.File}} is an abstract type and should therefore not return a specific value without the file-context of {{Ti.Filesystem.getFile(\"\", \"\")}}", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-11-02T11:43:31.000+0000", "updated": "2016-11-02T11:43:31.000+0000" }, { "id": "414403", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as invalid.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-21T21:02:36.000+0000", "updated": "2017-03-21T21:02:36.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }