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.
We had the same issue, after we updated our test device to iOS 16.0.2 our app stopped reading 2D barcodes properly (both QR Code and Data Matrix). On iOS 15, there was no issue detecting FNC1 character within the encoded data, which is used to read different GS1 elements. After the update, the app was unable to correctly detect the FNC1 character as well as other issues, which caused the workflow to be broken.
Today, we installed iOS 16.1 beta 3, I confirm that the app is working properly as intended, and the scanner is able to detect FNC1 character successfully. Everything went back to normal.
You can enroll your device in the Apple Beta Software Program to get the latest public betas, such as the one we tested out, iOS 16.1 beta 3.
Enrollment link:
https://beta.apple.com/sp/betaprogram/enroll#ios