Issue with TouchID, can't call functions


#1

** edit **

Seems like I have to pass TouchID in as a provider…my bad. Things are moving forward now :slight_smile:

Hey guys,

Running into an issue using TouchID, and was hoping someone could help shed some light on it for me.

import {TouchID, SpinnerDialog}  from "ionic-native";

Tried two things. When calling TouchID.is isAvailable() in the platform ready of my constructor, it does not find any methods on the TouchID object. If I call alert(TouchID), it returns an empty object … function TouchID() {}

If I insert the TouchID into my constructor like this

constructor(public touch: TouchID) {
    this.nav = nav;
    this.platform.ready().then(() => {
        this.touch.isAvailable()
    });
  }

my linter shows me the function is there, and I can now log out the object with all the methods on it…however when the public touch: TouchID is added to the constructor the app won’t load…so not much progress.

when I try to see what’s inside the TouchID object that’s been imported,

Any ideas? Note, the SpinnerDialog works just fine, and ionic-native has been updated to 1.2


#2

Close, but you actually don’t have to pass touchId in your constructor at all.

constructor(
  public platform: Platform
) {
  this.platform.ready().then(() => {
  TouchID.isAvailable()
});
}

#3

Still doesn’t work. Get the error back that there are no such methods on TouchID…My code is identical to yours @mhartington, but no dice. If I set a breakpoint inside platform.ready() and inspect/log TouchID, it returns an empty function oddly enough. No methods are inside.

Any ideas?


#4

I’m experiencing a similar problem with EddyVerbruggen’s touch id Cordova Plugin with Ionic 2.

It’s throwing an error that:

ORIGINAL EXCEPTION: TypeError: ionic_native_1.TouchID.isAvailable is not a function. (In ‘ionic_native_1.TouchID.isAvailable()’, ‘ionic_native_1.TouchID.isAvailable’ is undefined)

I checked the source of the plugin and isAvailable is an available method. I was using Lee Crossleys plugin cordova-cordova-touchid (as opposed to Eddys cordova-cordova-touch-id) and it was working, but after a successful touch id auth it would require pressing on another interactive element to fire the NavPush which wasn’t the best. So I’ve reverted to the trusted native plugin and it wont work at all!

Are there any updates around the stability of this plugin with Ionic 2 or is it just my environment?


#5

Seeing this as well, looks like the touchid.d.ts in ionic-native file is missing static on the isAvailable() function definition? @mhartington


_ionicNative.TouchID.isAvailable is not a function
#6

can we handle cancel in TouchID?