We are using the Vision library to scan a GS1 barcode.
The library does not recognize the special character "GS" in the iOS 16 versions.
"GS" --> Group Separator character (ASCII 29)
We do not encounter such an issue on older versions. For example iOS 15.6 or lower. I've uploaded a GS1 barcode example image below.
After scanning we should be getting: {GS}10BF50001A{GS}21003032{GS}1122012722VD020
What we get instead on iOS 16 is: 10BF50001A210030321122012722VD020
I'm also posting an example code on how we use the library. We have not changed our code and the bug appears only on the iOS 16 versions. We're wondering if there's been a bug introduced.
func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {
guard let pixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) else {
return
}
let imageRequestHandler = VNImageRequestHandler(cvPixelBuffer: pixelBuffer, orientation: .right)
do {
try imageRequestHandler.perform([detectBarcodeRequest])
} catch {
logger.error(tag: TAG, "barcode error: \(error)")
}
}
private 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)
}
private func processVNRequest(_ request: VNRequest) {
guard let barcodes = request.results else {
return
}
for barcode in barcodes {
guard let potentialBarcode = barcode as? VNBarcodeObservation else {
return
}
guard let payload = potentialBarcode.payloadStringValue else {
return
}
prepareToNotifyDetectionEvent(payload)
}
}
Thank you in advance.