Microblink : 扫描身份证正反面
Microblink : Scanning both side of ID card
我正在尝试使用 mirocolink 扫描国家卡的双面,根据他们扫描双面的文档,您必须使用 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
中看到响应
感谢您的帮助
我上次使用 microblink 是在一年多以前,但如果我没记错的话 documentVerificationOverlayViewControllerDidFinishScanningFirstSide
仅适用于受支持的身份证。
如果您要扫描来自其他国家/地区的身份证,则需要自行实施。
例如:
func documentVerificationOverlayViewControllerDidFinishScanning(_ documentVerificationOverlayViewController: MBDocumentVerificationOverlayViewController, state: MBRecognizerResultState) {
if step == .first {
// Present another ViewController for the back
showBackScanner()
} else {
processData()
}
}
您使用的是什么版本的 SDK?
在 5.2 版本中,我们添加了对德国身份证正面和背面的扫描。
您可以在此处下载最新版本:
https://github.com/BlinkID/blinkid-ios/releases
你现在可以测试一下吗,如果有效请告诉我们?
米兰
我正在尝试使用 mirocolink 扫描国家卡的双面,根据他们扫描双面的文档,您必须使用 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
感谢您的帮助
我上次使用 microblink 是在一年多以前,但如果我没记错的话 documentVerificationOverlayViewControllerDidFinishScanningFirstSide
仅适用于受支持的身份证。
如果您要扫描来自其他国家/地区的身份证,则需要自行实施。
例如:
func documentVerificationOverlayViewControllerDidFinishScanning(_ documentVerificationOverlayViewController: MBDocumentVerificationOverlayViewController, state: MBRecognizerResultState) {
if step == .first {
// Present another ViewController for the back
showBackScanner()
} else {
processData()
}
}
您使用的是什么版本的 SDK?
在 5.2 版本中,我们添加了对德国身份证正面和背面的扫描。
您可以在此处下载最新版本: https://github.com/BlinkID/blinkid-ios/releases
你现在可以测试一下吗,如果有效请告诉我们?
米兰