{ "id": "174827", "key": "TIMOB-27821", "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": "20950", "name": "Release 9.1.0", "archived": false, "released": true, "releaseDate": "2020-08-25" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2020-08-11T15:01:31.000+0000", "created": "2020-03-18T10:15:21.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2020-08-11T15:01:31.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'm using the module [ti.urlSession|https://github.com/appcelerator-modules/ti.urlsession] to fetch data in the background.\r\nThe issue is that when the download is complete and the event \"sessioncompleted\" fires, the input argument object doesn't contain all the values specified in the [documentation|http://docs.appcelerator.com/platform/latest/#!/api/Titanium.App.iOS-event-sessioncompleted], it's missing success, errorCode, message, responseText and statusCode. Basically all attributes connected to the http response.\r\n\r\nTo test this I set up a test application:\r\n\r\n*index.js*\r\n{code:javascript}\r\nvar URLSession = require(\"com.appcelerator.urlSession\");\r\nfunction doClick(e) {\r\n\talert($.label.text);\r\n\tvar sessionConfig = URLSession.createSessionConfiguration({identifier: \"test\"});\r\n\tvar session = URLSession.createSession({configuration: sessionConfig});\r\n\tvar task = session.downloadTask({url: \"http://ip.jsontest.com\"});\r\n}\r\nTi.App.iOS.addEventListener('downloadcompleted', function(e) {\r\n\tconsole.log('download complete', JSON.stringify(e));\r\n\tif (e.data) {\r\n\t\tconsole.log(e.data.text);\r\n\t}\r\n});\r\nTi.App.iOS.addEventListener('sessioncompleted', function(e) {\r\n\tconsole.log('Session complete', JSON.stringify(e));\r\n});\r\n$.index.open();\r\n{code}\r\n\r\n*index.html*\r\n{code:html}\r\n\r\n\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\nAnd this is the output that I get from running the application and tapping on the label:\r\n\r\n{noformat}\r\n[INFO] : download complete {\"sessionIdentifier\":\"test\",\"taskIdentifier\":1,\"data\":{},\"bubbles\":true,\"type\":\"downloadcompleted\",\"source\":{},\"cancelBubble\":false}\r\n[INFO] : {\"ip\": \"5.150.230.124\"}\r\n[INFO] : Session complete {\"taskIdentifier\":1,\"sessionIdentifier\":\"test\",\"bubbles\":true,\"type\":\"sessioncompleted\",\"source\":{},\"cancelBubble\":false}\r\n{noformat}\r\n\r\nI had this working last in Ti SDK 7.4.1.v20180927102822", "attachment": [], "flagged": false, "summary": "ti.urlsession - Event sessioncompleted does not get all specified values", "creator": { "name": "mnorrman", "key": "mnorrman", "displayName": "Mikael Norrman", "active": true, "timeZone": "Europe/Stockholm" }, "subtasks": [], "reporter": { "name": "mnorrman", "key": "mnorrman", "displayName": "Mikael Norrman", "active": true, "timeZone": "Europe/Stockholm" }, "environment": "iOS version - 13.3.1\r\nXCode - 11.3.1\r\nMacOS - 10.15.3\r\nTi SDK - 8.3.1.GA and 9.0.0.GA\r\nti.urlSession - 2.2.0", "closedSprints": [ { "id": 1199, "state": "closed", "name": "2020 Sprint 13", "startDate": "2020-06-19T16:41:04.099Z", "endDate": "2020-07-02T16:41:00.000Z", "completeDate": "2020-07-02T15:37:12.455Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "454800", "author": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~mnorrman] Did this same module version work with older SDK's? Or did an upgrade of the module break it?", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-03-23T09:04:08.000+0000", "updated": "2020-03-23T09:04:08.000+0000" }, { "id": "454801", "author": { "name": "mnorrman", "key": "mnorrman", "displayName": "Mikael Norrman", "active": true, "timeZone": "Europe/Stockholm" }, "body": "I'm pretty sure the same version (2.2.0) was working in TiSDK 7.4.1 but not in TiSDK 8+\r\n", "updateAuthor": { "name": "mnorrman", "key": "mnorrman", "displayName": "Mikael Norrman", "active": true, "timeZone": "Europe/Stockholm" }, "created": "2020-03-23T09:11:27.000+0000", "updated": "2020-03-23T09:11:27.000+0000" }, { "id": "455785", "author": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This is regression , introduced in SDK 7.5.0, due to PR https://github.com/appcelerator/titanium_mobile/pull/8860.", "updateAuthor": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-06-12T22:45:52.000+0000", "updated": "2020-06-12T22:45:52.000+0000" }, { "id": "455888", "author": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR - https://github.com/appcelerator/titanium_mobile/pull/11782\r\nTest Case (Download task)-\r\n\r\n{code:java}\r\n var win = Ti.UI.createWindow({\r\n backgroundColor: '#fff'\r\n });\r\n\r\n var label = Ti.UI.createLabel({\r\n text: 'click',\r\n color: \"#333\",\r\n font: {\r\n fontSize: 20\r\n }\r\n });\r\n\r\n win.add(label);\r\n\r\nvar URLSession = require(\"com.appcelerator.urlSession\");\r\n var sessionConfig = URLSession.createSessionConfiguration({identifier: \"test\"});\r\n var session = URLSession.createSession({configuration: sessionConfig});\r\n var task = session.downloadTask({url: \"http://ip.jsontest.com\"});\r\nlabel.addEventListener('click', function (e) {\r\n var sessionConfig = URLSession.createSessionConfiguration({identifier: \"test\"});\r\n var session = URLSession.createSession({configuration: sessionConfig});\r\n var task = session.downloadTask({url: \"http://ip.jsontest.com\"});\r\n});\r\n\r\nTi.App.iOS.addEventListener('downloadcompleted', function(e) {\r\n console.log('download complete', JSON.stringify(e));\r\n if (e.data) {\r\n console.log(e.data.text);\r\n }\r\n});\r\nTi.App.iOS.addEventListener('sessioncompleted', function(e) {\r\n console.log('Session complete', JSON.stringify(e));\r\n});\r\nwin.open();\r\n{code}\r\n\r\nTest Case (Data Task) -\r\n\r\n{code:java}\r\nvar URLSession = require('com.appcelerator.urlSession');\r\n \r\nvar sessionConfig = URLSession.createSessionConfiguration({\r\n identifier: 'com.test.test2'\r\n});\r\n \r\nvar session = URLSession.createSession({\r\n configuration: sessionConfig\r\n});\r\n \r\nvar window = Ti.UI.createWindow({\r\n backgroundColor: 'white',\r\n title: 'Ti.URLSession'\r\n});\r\n \r\nvar nav = Ti.UI.iOS.createNavigationWindow({\r\n window: window\r\n});\r\n \r\nvar triggerButton = Titanium.UI.createButton({\r\n title: 'Start Data Task'\r\n});\r\n \r\ntriggerButton.addEventListener('click', function() {\r\n \r\n var taskIdentifier = session.dataTask({\r\n url: 'https://httpbin.org/post',\r\n method: \"POST\",\r\n requestHeaders: {\r\n 'Content-Type': 'application/json'\r\n }\r\n });\r\n \r\n Ti.API.info('Starting data task with task identifier: ' + taskIdentifier);\r\n});\r\n \r\nwindow.add(triggerButton);\r\nnav.open();\r\n \r\n// Called when the data task completes\r\nTi.App.iOS.addEventListener('sessioncompleted', function(event) {\r\n alert('Session completed');\r\n Ti.API.info(JSON.stringify(event));\r\n});\r\n{code}\r\n\r\nNote - @QE Need to verify the event parameters are accordance with document. e.g\r\n 1. In download task 'sessioncomplete' will have 'statusCode' as well but no 'responseText'. \r\n 2. In dataTask it will have both properties", "updateAuthor": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-06-18T23:53:11.000+0000", "updated": "2020-06-19T19:30:43.000+0000" }, { "id": "455992", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FR Passed, waiting on Jenkins build", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-07-02T14:13:56.000+0000", "updated": "2020-07-02T14:13:56.000+0000" }, { "id": "456004", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "merged to master for 9.1.0 target", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2020-07-06T15:01:01.000+0000", "updated": "2020-07-06T15:01:01.000+0000" }, { "id": "456411", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "*Closing ticket*. Improvement verified in SDK version {{9.1.0.v20200810120239}}.\r\n\r\n*Test and other information can be found at:*\r\nhttps://github.com/appcelerator/titanium_mobile/pull/11782", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-08-11T15:01:16.000+0000", "updated": "2020-08-11T15:01:16.000+0000" } ], "maxResults": 9, "total": 9, "startAt": 0 } } }