TouchID Module - Error Domain=com.apple.LocalAuthentication Code=-1001 \"Unknown policy: '0'\"

1.2k views Asked by At

I am using the following TouchID Module (Version 2.1.0) with SDK 5.5.1.GA. But the issue is that when I am calling the isSupported() function with deviceCanAuthenticate(), I am getting the following error:

message = "Error Domain=com.apple.LocalAuthentication Code=-1001 \"Unknown policy: '0'\" UserInfo={NSLocalizedDescription=Unknown policy: '0'}";

The code that I am using is:

if (!TiTouchId.isSupported() || !TiTouchId.deviceCanAuthenticate().canAuthenticate) {
    alert("You cannot use this feature");
}

But if I swap the function calls, that is like this, then I do not get the error:

if (!TiTouchId.deviceCanAuthenticate().canAuthenticate || !TiTouchId.isSupported()) {
    alert("You cannot use this feature");
}

I am not sure as to why it is behaving in such a manner. I have loaded the module in alloy.js so that I can access it from any controller.

I am testing it in iOS Simulator 9.3 and also on iPhone 6 Plus device with iOS 10.2. On both the case I am getting the error. Is anyone facing this issue?

1

There are 1 answers

1
Soumya On BEST ANSWER

We need to call setAuthenticationPolicy and pass the information. Once that is done, then the issue gets resolved. (@TheFuquan provided the resolution)