Reputation: 3136
I'm asking the Microblink care reader to look at a photo of a card, rather than using the camera:
lazy var blinkCardRecognizer: MBCBlinkCardRecognizer = {
return MBCBlinkCardRecognizer()
}()
lazy var recognizerCollection: MBCRecognizerCollection = {
blinkCardRecognizer.extractCvv = false
blinkCardRecognizer.extractIban = false
blinkCardRecognizer.extractExpiryDate = false
let recognizerList = [blinkCardRecognizer]
return MBCRecognizerCollection(recognizers: recognizerList)
}()
My class has declared these two delegates:
MBCBlinkCardOverlayViewControllerDelegate, MBCScanningRecognizerRunnerDelegate
I'm sure that I'm passing this function a correct UIImage, and I do get to the processImage
call:
func prepareToReadImage(_ theImage: UIImage?) {
let recognizerRunner: MBCRecognizerRunner = MBCRecognizerRunner(recognizerCollection: recognizerCollection)
recognizerRunner.scanningRecognizerRunnerDelegate = self
var image: MBCImage? = nil
if let anImage = theImage {
image = MBCImage(uiImage: anImage)
}
image?.cameraFrame = true
image?.orientation = MBCProcessingOrientation.left
let _serialQueue = DispatchQueue(label: "com.microblink.DirectAPI-sample-swift")
_serialQueue.async(execute: {() -> Void in
recognizerRunner.processImage(image!)
})
}
But this callback is not being hit:
func recognizerRunner(_ recognizerRunner: MBCRecognizerRunner, didFinishScanningWith state: MBCRecognizerResultState) {
if state == .valid {
print (state)
}
}
Can you see why it isn't? Does it matter that I see the log warning You are using time-limited license key!
?
Upvotes: 1
Views: 158
Reputation: 196
From the presented code, I can see that the recognizerRunner
and the prepareToReadImage
methods have been entered correctly.
However, in the first block of code, where you're defining the recognizer and the recognizerCollection
, I can see that the issue could be with the MBCRecognizerCollection
since its parameter, recognizers
, is of type [MBCRecognizer]
, and you're placing there [MBCBlinkCardRecognizer]
. I can suggest this solution to see if it works:
blinkCardRecognizer = MBCBlinkCardRecognizer()
var recognizerList = [MBCRecognizer]()
let recognizerCollection: MBCRecognizerCollection = {
blinkCardRecognizer.extractCvv = false
blinkCardRecognizer.extractIban = false
blinkCardRecognizer.extractExpiryDate = false
recognizerList.append(blinkCardRecognizer!)
return MBCRecognizerCollection(recognizers: recognizerList)
}()
recognizerRunner = MBCRecognizerRunner(recognizerCollection: recognizerCollection)
The only difference is that I've previously defined the BlinkCardRecognizer and the RecognizerRunner, so that should not make any difference:
private var recognizerRunner: MBCRecognizerRunner?
private var blinkCardRecognizer: MBCBlinkCardRecognizer?
Just to add here, it does not matter if you see the You are using time-limited license key!
, it is simply an indicator that you using a time-limited key and it should not affect the scanning process.
Upvotes: 1