{ "id": "155116", "key": "AC-682", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2016-02-29T09:35:58.000+0000", "created": "2016-02-24T21:57:28.000+0000", "labels": [], "versions": [ { "id": "17035", "name": "Appcelerator Studio 4.4.0", "archived": false, "released": false } ], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2016-02-29T09:35:58.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": "I played around with the latest 5.2.0 SDK and Nexus 6P... for the most part everything seems to work except for one case with runtime permission.\r\n\r\nif I use Ti.Filesystem.tempDirectory as my storage and created the permission checks, this still fails on first try even if you accept the Permission. \r\n\r\nLog:\r\n{{[INFO] : Permission granted? true\r\n[ERROR] : TiFileProxy: (KrollRuntimeThread) [66154,66154] IOException encountered\r\n[ERROR] : TiFileProxy: java.io.FileNotFoundException: /storage/emulated/0/Android/data/com.apptest.tempdirperm/cache/_tmp/GettingStartedTitanium_Linux.pdf: open failed: ENOENT (No such file or directory)\r\n[ERROR] : TiFileProxy: \tat libcore.io.IoBridge.open(IoBridge.java:452)\r\n[ERROR] : TiFileProxy: \tat java.io.FileOutputStream.(FileOutputStream.java:87)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.titanium.io.TiFile.getOutputStream(TiFile.java:273)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.titanium.io.TiFile.open(TiFile.java:336)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.titanium.io.TiFile.write(TiFile.java:382)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.titanium.TiFileProxy.write(TiFileProxy.java:290)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.kroll.runtime.v8.V8Object.nativeCallProperty(Native Method)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.kroll.runtime.v8.V8Object.callProperty(V8Object.java:73)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1155)\r\n[ERROR] : TiFileProxy: \tat android.os.Handler.dispatchMessage(Handler.java:98)\r\n[ERROR] : TiFileProxy: \tat android.os.Looper.loop(Looper.java:148)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:118)\r\n[ERROR] : TiFileProxy: Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)\r\n[ERROR] : TiFileProxy: \tat libcore.io.Posix.open(Native Method)\r\n[ERROR] : TiFileProxy: \tat libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)\r\n[ERROR] : TiFileProxy: \tat libcore.io.IoBridge.open(IoBridge.java:438)\r\n[ERROR] : TiFileProxy: \t... 11 more\r\n[INFO] : ALERT: (KrollRuntimeThread) [41,66195] File exist? false}}\r\n\r\nSteps to recreate:\r\n* Create new Mobile App Project and paste in code to index.js\r\n* Compile and run, make sure it is a clean install on device\r\n* Click the \"Hello, World\" to trigger the download and permission.\r\n* Accept the permission on popup.\r\n* Accessing the file in temporary directory fails. (alert will say file does not exist)\r\n* Close the app\r\n* Check permission in settings > app permission (storage should be enabled)\r\n* Restart the app\r\n* Click \"Hello, World\" again to trigger download.\r\n* Alert will now say file exists.\r\n\r\nWorkaround: \r\nIf I switch the Ti.Filesystem.tempDirectory to Ti.Filesystem.applicationDataDirectory, I do not run into the issue of having to restart the app to open the file. But I have to make sure those files are deleted after use.\r\n\r\nIt would be best to use temporary directory so that the files are automatically removed after app is closed.", "attachment": [ { "id": "58323", "filename": "index.js", "author": { "name": "echeung@leviton.com", "key": "echeung@leviton.com", "displayName": "Eric Cheung", "active": true, "timeZone": "America/Havana" }, "created": "2016-02-24T21:55:43.000+0000", "size": 981, "mimeType": "text/javascript" }, { "id": "58322", "filename": "Screenshot_20160224-165334.png", "author": { "name": "echeung@leviton.com", "key": "echeung@leviton.com", "displayName": "Eric Cheung", "active": true, "timeZone": "America/Havana" }, "created": "2016-02-24T21:56:46.000+0000", "size": 86518, "mimeType": "image/png" }, { "id": "58321", "filename": "Screenshot_20160224-165342.png", "author": { "name": "echeung@leviton.com", "key": "echeung@leviton.com", "displayName": "Eric Cheung", "active": true, "timeZone": "America/Havana" }, "created": "2016-02-24T21:56:46.000+0000", "size": 64817, "mimeType": "image/png" } ], "flagged": false, "summary": "Android 6.0 (Post 5.2.0 SDK): java.io.FileNotFoundException: open failed: ENOENT (No such file or directory)", "creator": { "name": "echeung@leviton.com", "key": "echeung@leviton.com", "displayName": "Eric Cheung", "active": true, "timeZone": "America/Havana" }, "subtasks": [], "reporter": { "name": "echeung@leviton.com", "key": "echeung@leviton.com", "displayName": "Eric Cheung", "active": true, "timeZone": "America/Havana" }, "environment": "Appcelerator Studio 4.4.0\r\nTitanium SDK 5.2.0 GA\r\nMac OS X Yosemite 10.10.5\r\nAndroid Nexus 6P (6.0.1)", "comment": { "comments": [ { "id": "377814", "author": { "name": "echeung@leviton.com", "key": "echeung@leviton.com", "displayName": "Eric Cheung", "active": true, "timeZone": "America/Havana" }, "body": "Please close this... made a duplicate of TC-5878. Sorry", "updateAuthor": { "name": "echeung@leviton.com", "key": "echeung@leviton.com", "displayName": "Eric Cheung", "active": true, "timeZone": "America/Havana" }, "created": "2016-02-24T22:14:41.000+0000", "updated": "2016-02-24T22:14:41.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }