如何解决使用 FingerprintAIO 进行生物识别认证
我正在尝试通过指纹 aio 插件实现我的 Ionic v4 应用程序的身份验证。
但是,尝试使用时,出现以下错误(我在智能手机(android)上运行该应用程序:
TypeError: Object(...) is not a function
我按照Ionic Framework的官方文档做了安装:https://ionicframework.com/docs/native/fingerprint-aio
ionic cordova plugin add cordova-plugin-fingerprint-aio
npm install @ionic-native/fingerprint-aio
在 app.module.ts 中包含引用
import { FingerprintAIO } from '@ionic-native/fingerprint-aio/ngx';
@NgModule({
declarations: [MyApp],imports: [
BrowserModule,SharedModule,AutenticacaoModule,AdministracaoModule,ContaCorrenteModule,CoreModule,CorporativoModule,EmprestimoModule,InicioPageModule,InvestimentoModule,LoginPageModule,TransferenciaModule,AprovacaoModule,ComprovanteModule,HttpModule,CacheModule.forRoot(),IonicModule.forRoot(MyApp),IonicStorageModule.forRoot()
],bootstrap: [IonicApp],entryComponents: [MyApp],providers: [
StatusBar,SplashScreen,{ provide: ErrorHandler,useClass: IonicErrorHandler },{ provide: LOCALE_ID,useValue: 'pt-BR' },UtilitarioProvider,File,FileTransfer,FileOpener,AppVersion,GerenciarTokenService,Device,BarcodeScanner,SocialSharing,Screenshot,InAppBrowser,FingerprintAIO
]
})
export class AppModule {}
home.ts
.
.
.
import { FingerprintAIO } from '@ionic-native/fingerprint-aio/ngx';
@IonicPage()
@Component({
selector: 'home-login',templateUrl: 'home.html'
})
export class HomePage {
constructor(
private navCtrl: NavController,private autenticacaoService: AutenticacaoService,private toastCtrl: ToastController,private loadingCtrl: LoadingController,private usuarioService: UsuarioService,private warmupSerice: WarmupService,private menu: MenuController,private utilService: UtilService,public platform: Platform,private appVersion: AppVersion,private gerenciarToken: GerenciarTokenService,private iab: InAppBrowser,private faio: FingerprintAIO
) {
if (this.platform.is('cordova')) {
this.platform.ready().then(() => {
this.appVersion.getVersionNumber().then(ver => (this.versao = ver));
});
}
this.menu.swipeEnable(false);
}
biometric() {
try {
this.faio.show({
title: 'Biometric Authentication',// (Android Only) | optional | Default: "<APP_NAME> Biometric Sign On"
subtitle: 'Coolest Plugin ever',// (Android Only) | optional | Default: null
description: 'Please authenticate',// optional | Default: null
fallbackButtonTitle: 'Use Backup',// optional | When disableBackup is false defaults to "Use Pin".
// When disableBackup is true defaults to "Cancel"
disableBackup:true,// optional | default: false
})
.then((result: any) => alert(result))
.catch((error: any) => alert(error));
} catch (e) {
alert('catch ' + e);
}
}
}
我使用的是安卓 9.0.0
ionic cordova platform add android@9.0.0
我的离子信息
Ionic:
ionic (Ionic CLI) : 4.11.0 (C:\Users\xxxxxxx\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.4
Cordova:
cordova (Cordova CLI) : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 9.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0,cordova-plugin-ionic-webview 4.1.3,(and 14 other plugins)
System:
Android SDK Tools : 26.1.1 (C:\Users\xxxxxxx\AppData\Local\Android\Sdk)
NodeJS : v14.16.0 (C:\Program Files\nodejs\node.exe)
npm : 6.14.11
OS : Windows 10
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。