1

我正在尝试使用 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

谢谢你的帮助

4

2 回答 2

2

您使用的是什么版本的 SDK?

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

你可以在这里下载最新版本: https ://github.com/BlinkID/blinkid-ios/releases

你能现在测试一下,让我们知道它是否有效吗?

米兰

于 2020-02-12T13:29:32.410 回答
2

上次我使用 microblink 是一年多以前,但如果我没记错的话documentVerificationOverlayViewControllerDidFinishScanningFirstSide,它只适用于受支持的身份证。

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

例如:

func documentVerificationOverlayViewControllerDidFinishScanning(_ documentVerificationOverlayViewController: MBDocumentVerificationOverlayViewController, state: MBRecognizerResultState) {
    if step == .first {
        // Present another ViewController for the back
        showBackScanner()
    } else {
        processData()
    }
}
于 2020-02-12T11:08:46.440 回答