ipadOS 17.4: AVCaptureMetadataOutput delegate not called (qrscanner)
Asked Answered
E

0

6

I'm encountering an issue with the QR code scanner on my iPad 7th Gen running ipadOS 17.4. While the scanner seems to be functioning normally on the latest iPad 10th Gen (also on ipadOS 17.4), it's not working at all for ipad 7th gen (ipadOS 17.4) on my device.

It's possible that this problem affects other iPad models but for now I've tested just these two models.

Has anyone else experienced similar issues with the QR code scanner? Any suggestions for troubleshooting or a potential fix would be greatly appreciated.

List of tried device:

  • ipad 6Gen: KO
  • ipad 7Gen: KO
  • iPad 10Gen: OK
  • iPhone 15: OK
  • iPad 8th gen OK
  • iPad Air 4th gen OK
  • iPad Pro 12" 4th Gen OK
  • iPhone 15 Pro OK

Minor update

I tried to download AVCam project from official documentation of Apple and I confirm that is not working even in their swift project. But the face recognition is working

MetadataOutput

captureObject = [[AVCaptureMetadataOutput alloc]init];
objectQueue =       dispatch_queue_create("VideoDataOutputQueue", NULL);//dispatch_queue_create("newQueue", NULL);
[captureObject setMetadataObjectsDelegate:self queue:objectQueue];

I tried to use main_queue where creating the dispatch_queue but not delegating:

objectQueue =       dispatch_queue_create("VideoDataOutputQueue", NULL);//dispatch_queue_create("newQueue", dispatch_get_main_queue());

The problem is that is not delegating nor triggering the method:

- (void)captureOutput:(AVCaptureOutput *)output didOutputMetadataObjects:(NSArray<__kindof AVMetadataObject *> *)metadataObjects fromConnection:(AVCaptureConnection *)connection {
    
    if (metadataObjects != nil && metadataObjects.count > 0) {
        
        NSLog(@"%@", [metadataObjects objectAtIndex:0]);
         
        }
    }
}

WORKAROUND

There is no current solution up to now but i used a workaround using AVCaptureVideoDataOutputSampleBufferDelegate.

Then use the following output:

self.videoDataOutput = [[AVCaptureVideoDataOutput alloc] init];
[self.videoDataOutput setSampleBufferDelegate:self queue:dispatchQueue];
if ([_captureSession canAddOutput:self.videoDataOutput]) {
    [_captureSession addOutput:self.videoDataOutput];
}

Then using delegate method:

- (void)captureOutput:(AVCaptureOutput *)output didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection {
    CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);
    if (imageBuffer == NULL) {
        return;
    }
    CIImage *ciImage = [CIImage imageWithCVImageBuffer:imageBuffer];
    [self detectQRCode:ciImage];
}

-(void)detectQRCode:(CIImage *)image {
    NSDictionary* options;
    CIContext* context = [CIContext context];
    options = @{ CIDetectorAccuracy : CIDetectorAccuracyHigh };
    CIDetector* qrDetector = [CIDetector detectorOfType:CIDetectorTypeQRCode
                                                context:context
                                                options:options];
//    if ([[image properties] valueForKey:(NSString*) kCGImagePropertyOrientation] == nil) {
//        options = @{ CIDetectorImageOrientation : @1};
//    } else {
//        options = @{ CIDetectorImageOrientation : [[image properties] valueForKey:(NSString*) kCGImagePropertyOrientation]};
//    }
    
    NSArray * features = [qrDetector featuresInImage:image options:options];
    
    if (features == nil || [features count] == 0) {
        return;
    }
    CIQRCodeFeature *metadataObj = [features firstObject];
    NSString *qrString = [NSString  stringWithString:metadataObj.messageString];
    NSLog(@"feature: %@",qrString);
}


UPDATE

iOS 17.4.1 fixes the AVCaptureMetadataOutputObjectsDelegate.

Edgardo answered 8/3 at 13:30 Comment(13)
I've encountered this as well, it's very frustrating. I don't know of a workaround yet.Auliffe
ipad 6th gen is not working as wellEdgardo
We're having this problem as well, and it seems to affect scanning on any device that can handle iPadOS 17.4. Scanning works on those devices on 17.3. We are using AVCaptureSession, and thus far the difference between working/not working is that in 17.4, it's never identifying a metadataObject when pointed at a barcode. Why, I have no idea yet.Moffatt
reopen if interested. Added some code and more informationEdgardo
I filed a bug with Apple. I think this was an unintended consequence of something they patched in 17.4. feedbackassistant.apple.com/feedback/13680097Moffatt
Seeing the same thing with an iPad 6th gen and iPadOS 17.4 :/Cellule
Not working on iPad 6th gen and iPad 7th gen with iOS 17.4. iPad 8th gen with iOS 17.4 works fine.Moussaka
I can confirm scanning working on iPad 8th gen iPad Air 4th gen, iPad Pro 12" 4th Gen, and iPhone 15 Pro.Thorfinn
There is a statement regarding this issue from Apple support: support.apple.com/en-lamr/118614 It affects iPad 6th & 7th Gen, iPad Pro 12.9-inch (2nd Gen), iPad Pro 10.5-inchJude
Thanks to @Jude 's link. The webpage of it is updated. Now, it said upgrading to iOS 17.4.1 fixes the QR code scanning issue. I confirm that on my iPad 6. Unfortunately, it seems 17.4.1 fixes only QR code scanning. Bar codes, like Code 39, are not fixed😭Patina
I write a post about bar code scanning on Apple Community: discussions.apple.com/thread/255540933?sortBy=best Hope Apple fix it soon.Patina
I'm waiting to receive a refurbished iPad 6 to reproduce the issue myself. In the meantime, has anyone tried using DataScannerViewController, and can they confirm whether that also suffers from the issue for non-QR barcodes on iPadOS 17.4.1?Rebekahrebekkah
I confirm iOS 17.5 fixes the bar code scanning problem for iPad 6.Patina

© 2022 - 2024 — McMap. All rights reserved.