I am using AVFoundation to detect bar code and it is working for most of the bar code, I can get the string value from the bar code.
func metadataOutput(_ captureOutput: AVCaptureMetadataOutput, didOutput metadataObjects: [AVMetadataObject], from connection: AVCaptureConnection) {
if let barcodeData = metadataObjects.first {
if let readString = (barcodeData as? AVMetadataMachineReadableCodeObject)?.stringValue, readString != "" {
print("barcode found, \(readString)")
}
}
}
above method dose work most of the time but I found one barcode to which it return empty string. I downloaded few barcode scanner from Apple App Store and they were able to detect the stringValue. I downloaded sample code from https://developer.apple.com/library/content/samplecode/AVCamBarcode/Introduction/Intro.html and it did not work as well. I have also included all barcode type provided by apple in metadataObjectTypes just to make sure that I am not missing something. I have attached barcode which does not return the value.