{ "id": "166638", "key": "TIMOB-24489", "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": "17608", "name": "Release 6.1.0", "archived": false, "released": true, "releaseDate": "2017-05-26" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2017-04-12T09:44:53.000+0000", "created": "2017-03-16T13:50:48.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "6.0.1", "httpclient", "sdk", "touchid" ], "versions": [], "issuelinks": [], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2017-05-16T16:40:20.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": "This doesn't seem to work:\r\n{code:javascript}\r\nvar touchId = require(\"ti.touchid\");\r\ntouchId.authenticate({\r\n reason: \"Place your finger on the home button to login\",\r\n callback: function(e) {\r\n if (e.success === true) {\r\n // Success\r\n } else {\r\n // Cancel\r\n }\r\n }\r\n});\r\n{code}\r\n\r\n\r\nBut this works:\r\n{code:javascript}\r\nvar touchId = require(\"ti.touchid\");\r\ntouchId.authenticate({\r\n reason: \"Place your finger on the home button to login\",\r\n callback: function(e) {\r\n if (e.success === true) {\r\n // if you don't do this, Ti.Network fails later if it's\r\n // called from an event running in this callback\r\n setTimeout(function() {\r\n // Success\r\n },0);\r\n } else {\r\n // Cancel\r\n }\r\n }\r\n});\r\n{code}\r\n\r\nIf you don’t use the timeout 0:\r\n\r\n- on simulator *it’s fine* (with our without liveview)\r\n- on device with liveview *it’s fine*\r\n- on device without liveview *it fails*", "attachment": [], "flagged": false, "summary": "iOS: Ti.TouchID - Callback error with Ti.Network.createHTTPClient", "creator": { "name": "clement", "key": "clement", "displayName": "Clément Blanco", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "clement", "key": "clement", "displayName": "Clément Blanco", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "6.0.1.GA", "closedSprints": [ { "id": 883, "state": "closed", "name": "2017 Sprint 09 SDK", "startDate": "2017-04-23T21:46:54.309Z", "endDate": "2017-05-07T21:46:00.000Z", "completeDate": "2017-05-08T00:25:44.276Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "412791", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Please attach a full use-case that also includes the failing HTTPClient call. Use [httpbin|https://httpbin.org/] to call a demo-API.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-03-16T15:18:00.000+0000", "updated": "2017-03-16T15:18:00.000+0000" }, { "id": "412794", "author": { "name": "clement", "key": "clement", "displayName": "Clément Blanco", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{code:javascript}\r\nvar touchId = Ti.require(\"ti.touchid\");\r\ntouchId.authenticate({\r\n reason: \"Place your finger on the home button to login\",\r\n callback: function(e) {\r\n if (e.success === true) {\r\n var http = Ti.Network.createHTTPClient({\r\n onload : function(e) {\r\n Ti.API.info(\"Received text: \" + this.responseText);\r\n alert('success');\r\n },\r\n onerror : function(e) {\r\n Ti.API.debug(e.error);\r\n alert('error');\r\n },\r\n timeout : 5000\r\n });\r\n client.setRequestHeader(\"Accept\", \"application/json\");\r\n client.open(\"GET\", \"http://httpbin.org/get\");\r\n client.send();\r\n } else {\r\n // Cancel\r\n }\r\n }\r\n});\r\n{code}\r\n", "updateAuthor": { "name": "clement", "key": "clement", "displayName": "Clément Blanco", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-03-16T15:41:42.000+0000", "updated": "2017-03-16T15:43:48.000+0000" }, { "id": "413629", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Thanks! What's interesting is that if you use the main-thread instead of the kroll-thread, it works just fine. I'm also wondering if this used to work before and if other Ti-namespaces API's like Ti.Media or Ti.Geolocation have the same behavior. ", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-03-18T00:57:09.000+0000", "updated": "2017-03-18T00:57:09.000+0000" }, { "id": "415837", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "PR: https://github.com/appcelerator-modules/ti.touchid/pull/30\r\n\r\nPackaged module: https://github.com/appcelerator-modules/ti.touchid/releases/tag/ios-2.1.2\r\n\r\nTest-case (test with both kroll- and main-thread):\r\n{code:js}\r\nvar touchId = require(\"ti.touchid\");\r\n\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: '#fff'\r\n});\r\n\r\nvar btn = Ti.UI.createButton({\r\n title: 'Trigger'\r\n});\r\n\r\nbtn.addEventListener('click', function() {\r\n touchId.authenticate({\r\n reason: \"Place your finger on the home button to login\",\r\n callback: function(e) {\r\n if (e.success === true) {\r\n var http = Ti.Network.createHTTPClient({\r\n onload: function(e) {\r\n Ti.API.info(\"Received text: \" + this.responseText);\r\n alert('success');\r\n },\r\n onerror: function(e) {\r\n Ti.API.debug(e.error);\r\n alert('error');\r\n },\r\n timeout: 5000\r\n });\r\n http.setRequestHeader(\"Accept\", \"application/json\");\r\n http.open(\"GET\", \"http://httpbin.org/get\");\r\n http.send();\r\n } else {\r\n // Ignore case\r\n }\r\n }\r\n });\r\n});\r\n\r\nwin.add(btn);\r\nwin.open();\r\n{code}", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-03-26T11:18:28.000+0000", "updated": "2017-03-26T11:26:09.000+0000" }, { "id": "416653", "author": { "name": "clement", "key": "clement", "displayName": "Clément Blanco", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I've tried 2.1.2, this problem seems to have been solved but {{touchId.authenticate()}} seems to always return the following, no matter what:\r\n\r\n{code:javascript}\r\n{\r\n \"type\": \"callback\",\r\n \"success\": true,\r\n \"source\": {}\r\n}\r\n{code}\r\n\r\nShould I raise a different ticket?", "updateAuthor": { "name": "clement", "key": "clement", "displayName": "Clément Blanco", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-04-03T12:51:28.000+0000", "updated": "2017-04-03T12:54:21.000+0000" }, { "id": "416914", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Please note that iOS 10.2 (\\?), the user response is cached after a few recurring authorizations. You can force to show the dialog again by calling {{invalidate()}} in the success handling. But this behavior was the same before and did not change.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-04-06T13:13:01.000+0000", "updated": "2017-04-06T13:27:19.000+0000" }, { "id": "416915", "author": { "name": "clement", "key": "clement", "displayName": "Clément Blanco", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Ok good to know. I'll try again with 2.1.2.", "updateAuthor": { "name": "clement", "key": "clement", "displayName": "Clément Blanco", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-04-06T13:17:53.000+0000", "updated": "2017-04-06T13:17:53.000+0000" }, { "id": "417181", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~clement] Did you test it?", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-04-11T13:01:21.000+0000", "updated": "2017-04-11T13:01:21.000+0000" }, { "id": "417255", "author": { "name": "clement", "key": "clement", "displayName": "Clément Blanco", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Seems okay now with {{invalidate()}}.\r\n\r\nCan this be added to the {{readme.md}} on the github repo and/or in the official documentation?", "updateAuthor": { "name": "clement", "key": "clement", "displayName": "Clément Blanco", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-04-12T09:26:38.000+0000", "updated": "2017-04-12T09:26:38.000+0000" }, { "id": "417256", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Thanks! Done so in [this commit|https://github.com/appcelerator-modules/ti.touchid/commit/7586d447982426843a1cab0dffcc8bd51791afe5]. Also see [this discussion|http://stackoverflow.com/questions/38379125/touchid-activatetouchwithresponse-returns-success-without-requesting-fingerprint] in the native world and this Apple note\r\n{quote}\r\nThe duration for which Touch ID authentication reuse is allowable. If the device was successfully authenticated using Touch ID within the specified time interval, then authentication for the receiver succeeds automatically, without prompting the user for Touch ID. The default value is 0, meaning that Touch ID authentication cannot be reused. The maximum allowable duration for Touch ID authentication reuse is specified by the LATouchIDAuthenticationMaximumAllowableReuseDuration constant. You cannot specify a longer duration by setting this property to a value greater than this constant.\r\n{quote}\r\nTo restrict the reuse of an instance to a specific time, specify the {{allowableReuseDuration}} property in Titanium.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-04-12T09:43:16.000+0000", "updated": "2017-04-12T09:44:04.000+0000" }, { "id": "419788", "author": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Verified fixed, using:\r\nMacOS 10.12 (16A323)\r\nStudio 4.8.1.201612050850\r\nTi SDK 6.0.4.GA\r\nAppc NPM 4.2.9\r\nAppc CLI 6.2.1\r\nAlloy 1.9.11\r\nXcode 8.3.2 (8E2002)\r\n\r\nNo longer encounter error when using createHTTPClient and authenticate is returning correct values. Tested using provided samples codes and with additional projects from other touchID ticket tests.", "updateAuthor": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-05-16T16:40:20.000+0000", "updated": "2017-05-16T16:40:20.000+0000" } ], "maxResults": 11, "total": 11, "startAt": 0 } } }