上不存在
i正在尝试测试离子2中的触摸ID,但它不起作用。
export class HomePage {
private touchIdAvailable: boolean;
constructor(public _navCtrl: NavController, private _platform: Platform) {
this._platform.ready().then(() => {
TouchID.isAvailable().then(
res => alert('ok'),
err => alert('not ok')
);
this.touchIdAvailable = true;
})
}
private startTouchID() {
TouchID.verifyFingerprint('Fingerprints are Awesome')
.then(
res => alert('Pass'),
err => alert('Not Pass')
);
}
}
此代码不起作用。因此,如果我对代码的这一部分发表评论!
this._platform.ready().then(() => {
//TouchID.isAvailable().then(
// res => alert('tem'),
// err => alert('nao tem')
//);
this.touchIdAvailable = true;
})
我得到错误:proprety'isavaliable()'在'typeof touchid'
我找到了。
in/node_modules/ionic-native/dist/plugins/touchid.d.t.t.ts on 46 i更改:
isAvailable(): Promise<any>;
与此:
static isAvailable(): Promise<any>;
您不必编辑node_modules/ionic-native/dist/plugins/touchid.d.ts
只是在构造函数中初始化 TouchId
实例。
constructor(
private touchId: TouchID
) {
this.platform.ready().then(() => {
this.touchId.isAvailable().then(
res => this.touchIdAvailable = true,
err => this.touchIdAvailable = false
);
})
}