微眨眼:扫描身份证的两面



我正在尝试使用 mircoblink 扫描国家卡的两面,根据他们的文档扫描两面,您必须使用MBDocumentVerificationOverlayViewController作为控制器,MBBlinkIdCombinedRecognizer用于识别器。 但只有我的正面扫描效果很好。 我正在使用演示序列号,我不知道它是否与我的序列号有关。

这是我的代码:

/** Create BlinkID recognizer */
blinkIdRecognizer = MBBlinkIdCombinedRecognizer()
/** Create BlinkID settings */
let settings : MBDocumentVerificationOverlaySettings = MBDocumentVerificationOverlaySettings()
/** Crate recognizer collection */
let recognizerCollection : MBRecognizerCollection = MBRecognizerCollection(recognizers: [blinkIdRecognizer!])
/** Create your overlay view controller */
let documentOverlayViewController : MBDocumentVerificationOverlayViewController = MBDocumentVerificationOverlayViewController(settings: settings, recognizerCollection: recognizerCollection, delegate: self)
/** Create recognizer view controller with wanted overlay view controller */
let recognizerRunneViewController : UIViewController = MBViewControllerFactory.recognizerRunnerViewController(withOverlayViewController: documentOverlayViewController)
/** Present the recognizer runner view controller. You can use other presentation methods as well (instead of presentViewController) */
present(recognizerRunneViewController, animated: true, completion: nil)

这是我的委托代码:

extension MyVC: MBDocumentVerificationOverlayViewControllerDelegate {
func documentVerificationOverlayViewControllerDidFinishScanningFirstSide(_ documentVerificationOverlayViewController: MBDocumentVerificationOverlayViewController) {
print("First Side Scanned")
}
func documentVerificationOverlayViewControllerDidFinishScanning(_ documentVerificationOverlayViewController: MBDocumentVerificationOverlayViewController, state: MBRecognizerResultState) {
if (self.blinkIdRecognizer?.combinedResult.resultState == MBRecognizerResultState.valid) {
guard let result = blinkIdRecognizer?.combinedResult else {
return
}
DispatchQueue.main.async {
if self.blinkIdRecognizer?.combinedResult.scanningFirstSideDone == true {
} else {
documentVerificationOverlayViewController.dismiss(animated: true, completion: nil)
}
}
}
}
func documentVerificationOverlayViewControllerDidTapClose(_ documentVerificationOverlayViewController: MBDocumentVerificationOverlayViewController) {
self.dismiss(animated: true, completion: nil)
}
}

扫描第一面代表从未被调用,但我看到响应DidFinish

感谢您的任何帮助

您使用的是哪个版本的 SDK?

在 5.2 版中,我们添加了对德国身份证正面和背面的扫描。

您可以在此处下载最新版本: https://github.com/BlinkID/blinkid-ios/releases

您现在能否对其进行测试,并让我们知道这是否有效?

米兰

我最后一次使用微眨眼是在一年多前,但如果我没记错的话documentVerificationOverlayViewControllerDidFinishScanningFirstSide仅适用于支持的身份证。

如果您要扫描来自其他国家/地区的身份证,则需要自己实现。

例如:

func documentVerificationOverlayViewControllerDidFinishScanning(_ documentVerificationOverlayViewController: MBDocumentVerificationOverlayViewController, state: MBRecognizerResultState) {
if step == .first {
// Present another ViewController for the back
showBackScanner()
} else {
processData()
}
}

相关内容

  • 没有找到相关文章

最新更新