iOS Developer Library

Developer

AVFoundation Framework Reference AVCaptureMetadataOutputObjectsDelegate Protocol Reference

Options
Deployment Target:

On This Page
Language:

AVCaptureMetadataOutputObjectsDelegate

Inheritance


Not Applicable

Import Statement


Swift

import AVFoundation

Objective-C

@import AVFoundation;

Availability


Available in iOS 6.0 and later.

The AVCaptureMetadataOutputObjectsDelegate protocol must be adopted by the delegate of an AVCaptureMetadataOutput object . The single method in this protocol is optional. The method allows a delegate to respond when a capture metadata output object receives relevant metadata objects through its connection.

The AVCaptureMetadataOutput object calls the methods of the delegate object on the dispatch queue associated with its metadataObjectsCallbackQueue property.

  • Informs the delegate that the capture output object emitted new metadata objects.

    Declaration

    Swift

    optional func captureOutput(_ captureOutput: AVCaptureOutput!, didOutputMetadataObjects metadataObjects: [AnyObject]!, fromConnection connection: AVCaptureConnection!)

    Objective-C

    - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputMetadataObjects:(NSArray *)metadataObjects fromConnection:(AVCaptureConnection *)connection

    Parameters

    captureOutput

    The AVCaptureMetadataOutput object that captured and emitted the metadata objects.

    metadataObjects

    An array of AVMetadataObject instances representing the newly emitted metadata. Because AVMetadataObject is an abstract class, the objects in this array are always instances of a concrete subclass.

    connection

    The capture connection through which the objects were emitted.

    Discussion

    The AVCaptureMetadataOutput object emits only metadata objects whose types are included in its metadataObjectTypes property. The delegate implements this method to perform additional processing on metadata objects as they become available. If you plan to use metadata objects outside the scope of this method, you must store strong references to them and remove those references when the objects are no longer required.

    This method is executed on the dispatch queue specified by the metadataObjectsCallbackQueue property of the capture metadata output object. Because this method may be called frequently, your implementation should be efficient to prevent capture performance problems, including dropped metadata objects.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 6.0 and later.