Здесь код, используемый в приложении,
//setup recognizer
let usdlRecognizer = MBUsdlCombinedRecognizer()
usdlRecognizer.returnFullDocumentImage = true
usdlRecognizer.scanUncertain = false
// delegate
func documentVerificationOverlayViewControllerDidFinishScanning(_ documentVerificationOverlayViewController: MBDocumentVerificationOverlayViewController, state: MBRecognizerResultState) {
if state == MBRecognizerResultState.valid {
// first, pause scanning until we process all the results
documentVerificationOverlayViewController.recognizerRunnerViewController?.pauseScanning()
DispatchQueue.main.async(execute: {() -> Void in
documentVerificationOverlayViewController.dismiss(animated: false, completion: {
})
self.parseResult(recognizer: self.recognizer)
if let recognizer = self.recognizer as? MBUsdlCombinedRecognizer, recognizer.result.documentDataMatch == true {
// *********** Its always coming here even with mismatched cards ****************
print("both sides of cards matched.. success")
} else {
showAlert(title: "Error", message: "Data not matched", vc: self, okAction: {
})
}
})
}
}
Он всегда будет успешным блоком оператора if, даже если мы сканируем с водительскими правами другого человека в США.