Saturday, November 21, 2026
HomeiOS Developmentios - Imaginative and prescient scan not recognising GS1 barcode particular character...

ios – Imaginative and prescient scan not recognising GS1 barcode particular character on iOS16

[ad_1]

We’re utilizing the Imaginative and prescient library to scan a GS1 barcode.

The library doesn’t acknowledge the particular character “GS” within the iOS 16 variations.

We don’t encounter such a problem on older variations. For instance iOS 15.6 or decrease. I’ve uploaded a GS1 barcode instance picture beneath.

After scanning we needs to be getting: {GS}10BF50001A{GS}21003032{GS}1122012722VD020

What we get as a substitute on iOS 16 is: 10BF50001A210030321122012722VD020

I am additionally posting an instance code on how we use the library. Now we have not modified our code and the bug seems solely on the iOS 16 variations. We’re questioning if there’s been a bug launched.

func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {
    guard let pixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) else {
        return
    }

    let imageRequestHandler = VNImageRequestHandler(cvPixelBuffer: pixelBuffer, orientation: .proper)

    do {
        strive imageRequestHandler.carry out([detectBarcodeRequest])
    } catch {
        logger.error(tag: TAG, "barcode error: (error)")
    }
}

personal lazy var detectBarcodeRequest = VNDetectBarcodesRequest { [weak self] request, error in
    guard error == nil else {
        self?.logger.error(tag: self?.TAG, "barcode error: (error)")
        return
    }
    self?.processVNRequest(request)
}

personal func processVNRequest(_ request: VNRequest) {
    guard let barcodes = request.outcomes else {
        return
    }

    for barcode in barcodes {
        guard let potentialBarcode = barcode as? VNBarcodeObservation else {
            return
        }

        guard let payload = potentialBarcode.payloadStringValue else {
            return
        }

        prepareToNotifyDetectionEvent(payload)
    }
}

Thanks upfront.

GS1 Barcode example

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments