Search code examples
iosswiftcocoapodsmicroblinkblinkid

Microblink : Scanning both side of ID card


I am trying to scan both side of national card with mircoblink, based on their documentation for scanning both side you have to use MBDocumentVerificationOverlayViewController for controller and MBBlinkIdCombinedRecognizer for recognizer. but only my front side scanning works well. I am using demo serial key, I don't know is it related to to my serial key or not.

here is my code:

    /** 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)

This is my delegate code:

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)
    }

}

And scanning first side delegate never get called, but I see response in DidFinish

thanks for any help


Solution

  • What version of the SDK are you using?

    In version 5.2, we have added scanning for both the front and backside of the German ID.

    You can download the latest release here: https://github.com/BlinkID/blinkid-ios/releases

    Can you please test it now and let us know if that worked?

    Milan