TouchID always return false

I try to use TouchID, but this.touchId.isavaliable() always go into err. I test on my actual iPhone 7.

Here is my code
import { TouchID } from '@ionic-native/touch-id';
constructor(private touchId: TouchID){}

In my touch_id_login()

this.touchId.verifyFingerprint('Scan your finger')
res => {
let load = this.loadCtrl.create({
content: "Login...",
spinner: "crescent"
if(data.success){ this.db.set('username', this.username); load.dismiss(); this.navCtrl.setRoot(TabsPage); }else if(!data.success){ if(data.msg == 'no_user'){ load.dismiss(); this.showToast('no user'); return; } } })},
err => {this.showToast('fail');}
}, err=>{
this.showToast('TouchID unavaliable');

I really cant figure it out, please help

Probably a typo please confirm.

1 Like

oh, there just typo in my question, as you can see the code i have posted. I used isAvailable(). This really confuse me.

You should probably wrap this in platform.ready to make sure the Cordova plugin is actually loaded.


Now as suggested by Sujan, make sure that you are calling the touch_id_login() method from inside a platform.ready block or incorporate it inside the method itself and call the relevant code within that block. Or, if you are already doing that then let us know and show the whole code.

1 Like