{ "id": "140396", "key": "TIMOB-18078", "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": "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-26T22:43:11.000+0000", "created": "2014-11-24T13:18:39.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "module_stream", "parity", "qe-manualtest" ], "versions": [ { "id": "16676", "description": "Release 3.4.1", "name": "Release 3.4.1", "archived": false, "released": true, "releaseDate": "2014-11-14" } ], "issuelinks": [], "assignee": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2014-12-01T18:09:19.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": "h2. problem\r\n\r\nUsing {{Ti.Stream.read()}} with an open {{Ti.Filesystem.FileStream}} does nothing. The read call never invokes the result callback. Android works fine, but iOS always fails as described above, despite the documentation indicating that both support {{Ti.Stream.read()}} on FileStream. Without this support there is no asynchronous way to read files with Titanium on iOS, all reads must be blocking.\r\n\r\nh2. test case\r\n\r\n{code:javascript}\r\nvar file = Ti.Filesystem.getFile('app.js')\r\nvar stream = file.open(Ti.Filesystem.MODE_READ);\r\nvar buffer = Ti.createBuffer({length:8096});\r\nTi.Stream.read(stream, buffer, function(e) {\r\n Ti.API.error('I never get here');\r\n Ti.API.error(e);\r\n});\r\n{code}\r\n\r\nh2. expected\r\n\r\nThe results callback should return an event object ({{e}}) containing all relevant information regarding the read operation. Both {{Ti.API.error}} calls should execute and print the results.\r\n\r\nh2. actual\r\n\r\nThe results callback is never executed. Nothing is printed.", "attachment": [], "flagged": false, "summary": "iOS: Ti.Stream.read() doesn't work with Ti.Filesystem.FileStream", "creator": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Mac OSX, 8.1 sim\r\nTiSDK 3.4.1", "closedSprints": [ { "id": 258, "state": "closed", "name": "2014 Sprint 24 SDK", "startDate": "2014-11-24T22:28:25.425Z", "endDate": "2014-12-06T01:00:00.000Z", "completeDate": "2014-12-08T17:21:15.171Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "333403", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Pull pending\r\nmaster - https://github.com/appcelerator/titanium_mobile/pull/6381\r\n3_5_X - https://github.com/appcelerator/titanium_mobile/pull/6382", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-11-24T16:58:08.000+0000", "updated": "2014-11-24T17:01:30.000+0000" }, { "id": "333802", "author": { "name": "kagrawal", "key": "kagrawal", "displayName": "Khushbu Agrawal", "active": true, "timeZone": "Asia/Shanghai" }, "body": "[~tlukasavage] I tried to verify this ticket with the above mentioned testcase. It's crashing while opening the file object. \r\nCan you please have a look? ", "updateAuthor": { "name": "kagrawal", "key": "kagrawal", "displayName": "Khushbu Agrawal", "active": true, "timeZone": "Asia/Shanghai" }, "created": "2014-11-26T02:55:03.000+0000", "updated": "2014-11-26T02:55:03.000+0000" }, { "id": "333955", "author": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as fixed. Verified Ti.Stream.read() is working i.e. the event object is returned back in the callback. Used the following modified code:\r\n{code}\r\n var file = Ti.Filesystem.getFile('timob18078.txt');\r\n var stream = file.open(Ti.Filesystem.MODE_READ);\r\n var buffer = Ti.createBuffer({length:8096});\r\n \r\n Ti.Stream.read(stream, buffer, function(e) {\r\n Ti.API.error('I never get here');\r\n Ti.API.error(e);\r\n });\r\n{code}\r\n\r\nInstead of Ti.Filesystem.getFile('app.js'), created another text file and used Ti.Filesystem.getFile('timob18078.txt'); I think you will not be able to access app.js via Ti.Filesystem.getFile because of security reasons.\r\n\r\nTested on:\r\n\r\nAppcelerator Studio, build: 3.4.1.201410281743\r\nSDK build: 3.5.0.v20141125154115\r\nCLI: 3.4.1\r\nAlloy: 1.5.1\r\nXcode: 6.1.1 GM Seed\r\nDevices: iphone 6 plus (8.1), Samsung Galaxy S4 (4.4.2)", "updateAuthor": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-11-26T22:39:33.000+0000", "updated": "2014-11-26T22:39:33.000+0000" }, { "id": "333989", "author": { "name": "kagrawal", "key": "kagrawal", "displayName": "Khushbu Agrawal", "active": true, "timeZone": "Asia/Shanghai" }, "body": "[~wluu] Thanks for clarifying it.", "updateAuthor": { "name": "kagrawal", "key": "kagrawal", "displayName": "Khushbu Agrawal", "active": true, "timeZone": "Asia/Shanghai" }, "created": "2014-11-27T04:12:18.000+0000", "updated": "2014-11-27T04:12:18.000+0000" }, { "id": "334033", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Yeah, I believe app.js will only work on simulator tests. Thanks for the fix.", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-11-27T14:33:40.000+0000", "updated": "2014-11-27T14:33:40.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }