{ "id": "79380", "key": "TIMOB-5034", "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": "2", "description": "The problem described is an issue which will never be fixed.", "name": "Won't Fix" }, "resolutiondate": "2017-08-08T18:33:54.000+0000", "created": "2011-08-17T11:29:55.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "android", "defect", "ios" ], "versions": [ { "id": "11570", "description": "", "name": "Release 1.7.2", "archived": true, "released": true, "releaseDate": "2011-07-21" } ], "issuelinks": [], "assignee": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-08-08T18:33:54.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": [], "description": "Ti.Filesystem.File.setReadonly() fails silently on iOS (simulator) and crashes on Android with the error shown in the code comments below. You can drop the following into a default new TiMobile project to test:\r\n\r\n{code:lang=javascript}\r\nvar f = Titanium.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'test.txt');\r\nf.write('Hello World');\r\nTi.API.info('f exists: '+f.exists()); // = true\r\nTi.API.info('f contents: '+f.read()); // = Hello World\r\n// setReadonly has no effect on iOS simulator\r\n// On Android -- org.mozilla.javascript.EcmaError: TypeError: Cannot find function setReadonly in object [object TiFileProxy].\r\nf.setReadonly(); \r\nTi.API.info('File is read only: '+f.readonly); // = false on iOS\r\ntry {\r\n\tf.deleteFile();\r\n\tTi.API.info('deleting worked');\r\n\tTi.API.info('f contents = '+f.read());\r\n} catch(e) {\r\n\talert('Error: '+Ti.API.error);\r\n\talert(e.error);\r\n}\r\n{code}\r\n\r\nAssociate API docs: [http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Filesystem.File.setReadonly-method.html]\r\n", "attachment": [], "flagged": false, "summary": "Ti.File.setReadonly() does nothing on iOS and throws an error on Android", "creator": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "subtasks": [], "reporter": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "environment": null, "comment": { "comments": [ { "id": "426204", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing due to inactivity. If this issue still exists, please raise a new ticket. To add, the associated URL is no longer valid.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-08-08T18:33:54.000+0000", "updated": "2017-08-08T18:33:54.000+0000" } ], "maxResults": 1, "total": 1, "startAt": 0 } } }