{ "id": "159073", "key": "TIMOB-23116", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "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": "17706", "name": "Release 5.4.0", "archived": false, "released": true, "releaseDate": "2016-08-11" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-03-28T17:11:28.000+0000", "created": "2016-03-27T16:02:58.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "ios", "nsurlsession", "qe-5.4.0", "sessionIdentifier" ], "versions": [], "issuelinks": [], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2016-08-05T17:52: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": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "There is a community PR to add the {{sessionIdentifier}} to the URLSession: https://github.com/appcelerator/titanium_mobile/pull/6941\r\n\r\nWe need to do the following:\r\n* Nil-validations for the case that the sessionIdentifier is nil\r\n* The docs for the new property, as well as the docs for the uploadprogress event\r\n* The missing dictionary in URLSessionDidFinishEventsForBackgroundURLSession.", "attachment": [], "flagged": false, "summary": "iOS: Add sessionIdentifier to URLSession events", "creator": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "closedSprints": [ { "id": 614, "state": "closed", "name": "2016 Sprint 07 SDK", "startDate": "2016-03-26T00:38:56.432Z", "endDate": "2016-04-09T00:38:00.000Z", "completeDate": "2016-04-11T04:41:08.231Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "380747", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "PR: https://github.com/appcelerator/titanium_mobile/pull/7889", "updateAuthor": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-03-27T16:39:02.000+0000", "updated": "2016-08-04T23:45:37.000+0000" }, { "id": "392403", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Test-case:\r\n1. Follow [this guide|http://docs.appcelerator.com/platform/latest/#!/guide/iOS_Background_Services-section-37539664_iOSBackgroundServices-URLSessionModule] to use the urlSession module with Titanium\r\n2. Inside the {{downloadprogress}} and {{downloadcompleted}} event, watch out for the {{sessionIdentifier}} property when it is called.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-08-04T09:25:32.000+0000", "updated": "2016-08-04T09:25:32.000+0000" }, { "id": "392472", "author": { "name": "jlongton", "key": "jlongton", "displayName": "Josh Longton", "active": true, "timeZone": "Europe/London" }, "body": "[~hansknoechel] I am getting an invalid session error when testing the sessionIdentifier.\r\n\r\nh4. Error\r\n\r\n\r\n{code:shell}\r\n[ERROR] : Error: invalid session\r\n at makeError (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/appc-platform-sdk/lib/auth.js:87:14)\r\n at /Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/appc-platform-sdk/lib/auth.js:256:21\r\n at Request._callback (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/appc-platform-sdk/lib/index.js:354:11)\r\n at Request.self.callback (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/request/request.js:187:22)\r\n at emitTwo (events.js:87:13)\r\n at Request.emit (events.js:172:7)\r\n at Request. (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/request/request.js:1044:10)\r\n at emitOne (events.js:77:13)\r\n at Request.emit (events.js:169:7)\r\n at IncomingMessage. (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/request/request.js:965:12)\r\n at emitNone (events.js:72:20)\r\n at IncomingMessage.emit (events.js:166:7)\r\n at endReadableNT (_stream_readable.js:913:12)\r\n---------------------------------------------\r\n at Request.init (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/request/request.js:190:10)\r\n at new Request (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/request/request.js:129:8)\r\n at request (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/request/index.js:55:10)\r\n at Function.get (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/request/index.js:63:12)\r\n at _createRequest (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/appc-platform-sdk/lib/index.js:429:39)\r\n at Function.AppC.createRequest (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/appc-platform-sdk/lib/index.js:387:9)\r\n at /Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/appc-platform-sdk/lib/auth.js:251:8\r\n at /Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/appc-platform-sdk/node_modules/async/lib/async.js:251:17\r\n at /Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/appc-platform-sdk/node_modules/async/lib/async.js:154:25\r\n at /Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/appc-platform-sdk/node_modules/async/lib/async.js:248:21\r\n at /Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/appc-platform-sdk/node_modules/async/lib/async.js:612:34\r\n at /Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/appc-platform-sdk/lib/auth.js:110:3\r\n at next (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/tough-cookie/lib/cookie.js:994:9)\r\n at MemoryCookieStore.putCookie (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/tough-cookie/lib/memstore.js:118:3)\r\n at withCookie (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/tough-cookie/lib/cookie.js:1013:13)\r\n---------------------------------------------\r\n at cli.addHook.post (/Users/Josh/Library/Application Support/Titanium/mobilesdk/osx/5.4.0.v20160802165655/iphone/cli/hooks/run.js:52:7)\r\n at /Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/titanium/lib/hook.js:235:13\r\n at /Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/titanium/node_modules/async/lib/async.js:689:13\r\n at iterate (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/titanium/node_modules/async/lib/async.js:265:13)\r\n at nextTickCallbackWith0Args (node.js:420:9)\r\n at process._tickCallback (node.js:349:13)\r\n[ERROR] : Error: invalid session\r\n at makeError (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/appc-platform-sdk/lib/auth.js:87:14)\r\n at /Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/appc-platform-sdk/lib/auth.js:256:21\r\n at Request._callback (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/appc-platform-sdk/lib/index.js:354:11)\r\n at Request.self.callback (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/request/request.js:187:22)\r\n at emitTwo (events.js:87:13)\r\n at Request.emit (events.js:172:7)\r\n at Request. (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/request/request.js:1044:10)\r\n at emitOne (events.js:77:13)\r\n at Request.emit (events.js:169:7)\r\n at IncomingMessage. (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/request/request.js:965:12)\r\n at emitNone (events.js:72:20)\r\n at IncomingMessage.emit (events.js:166:7)\r\n at endReadableNT (_stream_readable.js:913:12)\r\n---------------------------------------------\r\n at Request.init (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/request/request.js:190:10)\r\n at new Request (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/request/request.js:129:8)\r\n at request (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/request/index.js:55:10)\r\n at Function.get (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/request/index.js:63:12)\r\n at _createRequest (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/appc-platform-sdk/lib/index.js:429:39)\r\n at Function.AppC.createRequest (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/appc-platform-sdk/lib/index.js:387:9)\r\n at /Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/appc-platform-sdk/lib/auth.js:251:8\r\n at /Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/appc-platform-sdk/node_modules/async/lib/async.js:251:17\r\n at /Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/appc-platform-sdk/node_modules/async/lib/async.js:154:25\r\n at /Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/appc-platform-sdk/node_modules/async/lib/async.js:248:21\r\n at /Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/appc-platform-sdk/node_modules/async/lib/async.js:612:34\r\n at /Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/appc-platform-sdk/lib/auth.js:110:3\r\n at next (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/tough-cookie/lib/cookie.js:994:9)\r\n at MemoryCookieStore.putCookie (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/tough-cookie/lib/memstore.js:118:3)\r\n at withCookie (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/tough-cookie/lib/cookie.js:1013:13)\r\n---------------------------------------------\r\n at cli.addHook.post (/Users/Josh/Library/Application Support/Titanium/mobilesdk/osx/5.4.0.v20160802165655/iphone/cli/hooks/run.js:52:7)\r\n at /Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/titanium/lib/hook.js:235:13\r\n at /Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/titanium/node_modules/async/lib/async.js:689:13\r\n at iterate (/Users/Josh/.appcelerator/install/5.4.0-38/package/node_modules/titanium/node_modules/async/lib/async.js:265:13)\r\n at nextTickCallbackWith0Args (node.js:420:9)\r\n at process._tickCallback (node.js:349:13)\r\n{code}\r\n\r\n \r\nh4. ENV\r\n{code:java}\r\niPhone 6s (9.3.1)\r\niOS Simulator (9.3)\r\n
Mac OSX El Capitan 10.11.6\r\nStudio: 4.7.0.201607250649\r\n
Ti SDK: 5.4.0.v20160804021257\r\n
Appc NPM: 4.2.7\r\nAppc CLI: 5.4.0-38\r\nNode: v4.4.4\r\n{code}\r\n\r\nh4. App.js used\r\n{code:javascript}\r\n// Require in the urlSession module\r\nvar urlSession = require(\"com.appcelerator.urlSession\");\r\nvar session;\r\n// App UI\r\nvar win = Ti.UI.createWindow({backgroundColor:\"white\"});\r\nvar progress = Ti.UI.createProgressBar({\r\n width: 200,\r\n height: 50,\r\n min: 0,\r\n max: 1,\r\n value: 0,\r\n style: Ti.UI.iOS.ProgressBarStyle.PLAIN,\r\n top: 10,\r\n message: 'Downloading image URL',\r\n font: { fontSize: 12, fontWeight: 'bold'},\r\n color: '#888'\r\n});\r\nwin.add(progress);\r\nvar imageView = Ti.UI.createImageView({\r\n top:150,\r\n height:300,\r\n width:200\r\n });\r\nwin.add(imageView);\r\nvar button = Ti.UI.createButton({\r\n title:'Download Image (url)',\r\n height:40,\r\n width:200,\r\n top:70\r\n});\r\nbutton.addEventListener('click', function()\r\n{\r\n // Create a session configuration\r\n // The string parameter is an arbitrary string used to identify the session in events\r\n var sessionConfig = urlSession.createURLSessionBackgroundConfiguration(\"com.appcelerator.test\");\r\n // Create a session\r\n session = urlSession.createURLSession(sessionConfig);\r\n // Create a background download task to get the asset with the URL\r\n urlSession.backgroundDownloadTaskWithURL(session,\"https://raw.github.com/appcelerator-developer-relations/KitchenSink/master/Resources/images/dog@2x~iphone.jpg\");\r\n progress.show();\r\n});\r\nwin.add(button);\r\nwin.open();\r\n \r\n// Monitor this event to receive updates on the progress of the download\r\nTi.App.iOS.addEventListener(\"downloadprogress\", function(e) {\r\n // Update the progress indicator\r\n progress.value = (e.totalBytesWritten/e.totalBytesExpectedToWrite);\r\n Ti.API.info(\"download progress \" + JSON.stringify(e));\r\n});\r\n// Monitor this event to know when the download completes\r\nTi.App.iOS.addEventListener(\"downloadcompleted\", function(e) {\r\n Ti.API.info(\"download completed \" + JSON.stringify(e));\r\n \r\n // Update the image\r\n imageView.image = e.data;\r\n \r\n // Invalidate the session and cancel current session tasks\r\n urlSession.invalidateAndCancel(session);\r\n // Notify the user the download is complete if the application is in the background\r\n Ti.App.iOS.scheduleLocalNotification({\r\n alertBody:\"Download complete!\",\r\n date:new Date().getTime() \r\n });\r\n progress.hide();\r\n});\r\n// Monitor this event to know when all session tasks have completed\r\nTi.App.iOS.addEventListener('sessioncompleted', function(e) {\r\n Ti.API.info(\"sessioncompleted \" + JSON.stringify(e));\r\n if (e.success) {\r\n alert(\"Downloads completed successfully.\");\r\n }\r\n});\r\n{code}\r\n", "updateAuthor": { "name": "jlongton", "key": "jlongton", "displayName": "Josh Longton", "active": true, "timeZone": "Europe/London" }, "created": "2016-08-04T23:26:17.000+0000", "updated": "2016-08-04T23:26:17.000+0000" }, { "id": "392488", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "[~jlongton] The error log you are showing seems like it's involved with appc-platform-sdk, may not have anything to do with this ticket. Can you verify:\r\n1. If you are on preprod or prod\r\n2. Try using appc cli core 5.3.1\r\n", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-08-05T04:10:29.000+0000", "updated": "2016-08-05T04:10:29.000+0000" }, { "id": "392534", "author": { "name": "jlongton", "key": "jlongton", "displayName": "Josh Longton", "active": true, "timeZone": "Europe/London" }, "body": "Verified as fixed, the error is not present now.\r\n\r\nTested on:\r\n{code:java}\r\niPhone 6s (9.3.1)\r\niOS Simulator (9.3)\r\n
Mac OSX El Capitan 10.11.6\r\nStudio: 4.7.0.201607250649\r\n
Ti SDK: 5.4.0.v20160804185318\r\n
Appc NPM: 4.2.7\r\nAppc CLI: 5.4.0-40\r\nNode: v4.4.4\r\n{code}\r\n\r\n*Closing ticket*", "updateAuthor": { "name": "jlongton", "key": "jlongton", "displayName": "Josh Longton", "active": true, "timeZone": "Europe/London" }, "created": "2016-08-05T17:52:14.000+0000", "updated": "2016-08-05T17:52:14.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }