iOS 7 AVCaptureMetadataOutput delegate (QRCode scanner)

后端 未结 2 466
青春惊慌失措
青春惊慌失措 2021-01-30 15:19

I\'m trying to implement a QRCode scanner with the new iOS 7 features but my code isn\'t calling the main AVCaptureMetadataOutputObjectsDelegate method.

I\'

相关标签:
2条回答
  • 2021-01-30 15:43

    iOS 10 caused the same problem for me. I currently have the developer edition released at WWDC 2016. When I ran the app on a phone with iOS 9 the captureOutput:didOutputMetadataObjects: method was called again.

    0 讨论(0)
  • 2021-01-30 15:50

    I am trying to figure this out myself. The documentation seems to say that if you don't set the type(s) you want in metadataObjectTypes, you won't get any calls. But my iPad Mini's back camera returns an empty array for availableMetadataObjectTypes. Let us know what you figure out.

    Edit:

    I just figured out that if you add the AVCaptureMetadataOutput object to the session, the availableMetadataObjectTypes gets filled in and you can add the barcode detector to it. Then the captureOutput delegate will get called, so like this:

    AVCaptureMetadataOutput *output = [[AVCaptureMetadataOutput alloc] init];
    [output setMetadataObjectsDelegate:self queue:dispatch_get_main_queue()];
    [session addOutput:output];
    output.metadataObjectTypes = @[AVMetadataObjectTypeQRCode];
    
    0 讨论(0)
提交回复
热议问题