[TIMOB-24489] iOS: Ti.TouchID - Callback error with Ti.Network.createHTTPClient
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2017-04-12T09:44:53.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 6.1.0 |
Components | n/a |
Labels | 6.0.1, httpclient, sdk, touchid |
Reporter | Clément Blanco |
Assignee | Hans Knöchel |
Created | 2017-03-16T13:50:48.000+0000 |
Updated | 2017-05-16T16:40:20.000+0000 |
Description
This doesn't seem to work:
var touchId = require("ti.touchid");
touchId.authenticate({
reason: "Place your finger on the home button to login",
callback: function(e) {
if (e.success === true) {
// Success
} else {
// Cancel
}
}
});
But this works:
var touchId = require("ti.touchid");
touchId.authenticate({
reason: "Place your finger on the home button to login",
callback: function(e) {
if (e.success === true) {
// if you don't do this, Ti.Network fails later if it's
// called from an event running in this callback
setTimeout(function() {
// Success
},0);
} else {
// Cancel
}
}
});
If you don’t use the timeout 0:
- on simulator *it’s fine* (with our without liveview)
- on device with liveview *it’s fine*
- on device without liveview *it fails*
Please attach a full use-case that also includes the failing HTTPClient call. Use [httpbin](https://httpbin.org/) to call a demo-API.
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.
PR: https://github.com/appcelerator-modules/ti.touchid/pull/30 Packaged module: https://github.com/appcelerator-modules/ti.touchid/releases/tag/ios-2.1.2 Test-case (test with both kroll- and main-thread):
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:Should I raise a different ticket?
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.Ok good to know. I'll try again with 2.1.2.
[~clement] Did you test it?
Seems okay now with
invalidate()
. Can this be added to thereadme.md
on the github repo and/or in the official documentation?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 {quote} The 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. {quote} To restrict the reuse of an instance to a specific time, specify the
allowableReuseDuration
property in Titanium.Verified fixed, using: MacOS 10.12 (16A323) Studio 4.8.1.201612050850 Ti SDK 6.0.4.GA Appc NPM 4.2.9 Appc CLI 6.2.1 Alloy 1.9.11 Xcode 8.3.2 (8E2002) No 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.