当我尝试运行此代码时,它崩溃并说此错误:
ERROR TypeError: this.blinkId.BlinkCardOverlaySettings is not a constructor
怎么了?我认为这是打字稿 Microblink SDK 包装器上的插件问题,这是来自BlinkId Plugin的示例
import { BlinkId, RecognizerResultState } from '@ionic-native/blinkid/ngx';
constructor(private blinkId: BlinkId) {}
scan(){
const overlaySettings = new this.blinkId.BlinkCardOverlaySettings();
const recognizer = new this.blinkId.BlinkCardRecognizer();
recognizer.returnFullDocumentImage = false;
recognizer.detectGlare = true;
recognizer.extractCvv = true;
recognizer.extractValidThru = true;
recognizer.extractOwner = true;
const recognizerCollection = new this.blinkId.RecognizerCollection([recognizer]);
const canceled = this.blinkId.scanWithCamera(
overlaySettings,
recognizerCollection,
{
ios: 'my key', //iOS License Key
android: my key' //Android License Key
},
);
if (!canceled) {
if (recognizer.result.resultState === RecognizerResultState.valid) {
const results = recognizer.result;
if (results.resultState === RecognizerResultState.valid) {
const ccInfo = {
cardNumber: Number(results.cardNumber),
expirationMonth: Number(results.validThru.month),
expirationYear: Number(results.validThru.year),
cvv: Number(results.cvv)
};
console.log("TCL: scan -> ccInfo", ccInfo)
}
}
}
}