1

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

Jonas
  • 121,568
  • 97
  • 310
  • 388
Mahdi
  • 94
  • 10

2 Answers2

2

Last time I've worked with microblink was over a year ago but if I recall correctly documentVerificationOverlayViewControllerDidFinishScanningFirstSide is only available for the supported id cards.

If you're scanning an ID card from another country you'll need to implement that yourself.

For example:

func documentVerificationOverlayViewControllerDidFinishScanning(_ documentVerificationOverlayViewController: MBDocumentVerificationOverlayViewController, state: MBRecognizerResultState) {
    if step == .first {
        // Present another ViewController for the back
        showBackScanner()
    } else {
        processData()
    }
}
ahbou
  • 4,710
  • 23
  • 36
  • Thanks for response, but `documentVerificationOverlayViewControllerDidFinishScanning` never get called, do I have to set another delegate, in showBackScanner do you call any method or something I didn't find anything related to showing back side scanner. I am looking to scan Germany ID card – Mahdi Feb 12 '20 at 11:11
  • What do you mean by you see a response in `DidFinish` ? – ahbou Feb 12 '20 at 11:13
  • `documentVerificationOverlayViewControllerDidFinishScanningFirstSide` this is never get called but after scanning first side `documentVerificationOverlayViewControllerDidFinishScanning` get called and I will get front side response, I looked at their interfaces and didn't find anything to switch between back side – Mahdi Feb 12 '20 at 11:18
  • For unsupported IDs, I just presented a new DocumentOverlayViewController and handled the state myself – ahbou Feb 12 '20 at 16:04
  • I am also facing the same issue with android. Is there any callback method whether the front page scanning done and rear page scanning done in the multi page scanning? @ahbou – ShankarManickavasagam Jul 04 '23 at 05:54
2

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

mipar
  • 171
  • 1
  • 3