swiftgoogle-ios-vision

Initiating GMVDetector fails


I'm using GoogleMobileVision/Barcode detector in my Swift 3.1 project using the following code:

GMVDetector(ofType: GMVDetectorTypeBarcode, options: nil)

but in the log it shows:

log

It seems that GoogleMobileVision in iOS is closed source so I cannot really see what's happening on the implementation side

Any thoughts on what possibly is happening here?


Solution

  • I think you need to put some optional value of barcode type like EAN13 or QRcode instead of nil.

    var detector = GMVDetector()
    let options:[AnyHashable: Any] = [GMVDetectorBarcodeFormats : GMVDetectorBarcodeFormat.EAN13.rawValue]
    self.detector = GMVDetector.init(ofType: GMVDetectorTypeBarcode, options: options)