title: Unable to detect a barcode from an image using Firebase's MLKit
body: <p>So, i'am trying to scan a barcode with MLKit, but there are no barcodes in the barcode variable in the completion block of <code>self.barcodeDetector?.detect</code>.</p>
  
  <p>The UIImage(named: "barcode.jpg") exists and is loaded correctly (and has barcodes).</p>
  
  <p>So what am I doing wrong/what am I missing?</p>
  
  <pre><code>private var barcodeDetector: VisionBarcodeDetector?
  private lazy var vision = Vision.vision()
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      guard let barcodeImage = self.imageView.image else { return }
  
      let format = VisionBarcodeFormat.all
      let barcodeOptions = VisionBarcodeDetectorOptions(formats: format)
      let barcodeDetector = self.vision.barcodeDetector(options: barcodeOptions)
  
      let imageMetadata = VisionImageMetadata()
      imageMetadata.orientation = UIUtilities.visionImageOrientation(from: barcodeImage.imageOrientation)
  
      let visionImage = VisionImage(image: barcodeImage)
      visionImage.metadata = imageMetadata
  
      self.textView.text = ""
  
      barcodeDetector.detect(in: visionImage) { (barcodes, error) in
      guard error == nil, let barcodes = barcodes, !barcodes.isEmpty else {
          let errorString = error?.localizedDescription ?? "No error description available"
          self.textView.text = "On-Device barcode detection failed with error: \(errorString)"
          return
      }
  
      self.textView.text = self.textView.text + "\(self.dateFormatter.string(from: Date())) detecting ...\n"
      self.textView.text = self.textView.text + "barcodes.count = \(barcodes.count)" + "\n"
      print(barcodes.count)
  
      for barcode in barcodes {
          self.textView.text = self.textView.text + "\(barcode)" + "\n"
          print(barcode)
      }
  }
  </code></pre>
  
  <p>So the problem is that the barcodes var is empty so the code in the for loop is not reached...:</p>
  
  <pre><code>        for barcode in barcodes! {
              print(barcode.rawValue!)
          }
  </code></pre>
  
  <p>P.s. The error variable = nil, so that's not the problem.</p>
  
  <p>image used: 
  <a href="https://i.stack.imgur.com/ZmabS.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/ZmabS.jpg" alt="enter image description here"></a></p>