AVFoundation.AVMetadataMachineReadableCodeObject Class
A AVFoundation.AVMetadataObject that contains barcode information.

See Also: AVMetadataMachineReadableCodeObject Members

Syntax

[Foundation.Register("AVMetadataMachineReadableCodeObject", true)]
[ObjCRuntime.Availability(Introduced=ObjCRuntime.Platform.iOS_7_0)]
public class AVMetadataMachineReadableCodeObject : AVMetadataObject

Remarks

The following barcode types can be natively recognized in iOS 7:

Barcode typeConstant for use with AVMetadataOutput.MetadataObjectType
AztecAVMetadataObject.TypeAztecCode
Code 39AVMetadataObject.TypeCode39Code
Code 39 mod 43AVMetadataObject.TypeCode39Mod43Code
Code 93AVMetadataObject.TypeCode93Code
Code 128AVMetadataObject.TypeCode128Code
PDF417AVMetadataObject.TypeCodePDC417Code
QRAVMetadataObject.TypeQRCode
UPC-EAVMetadataObject.TypeUPCECode

To recognize a barcode, application developers assign to the AVCaptureMetadataOutput.MetadataObjectTypes property. This must be done after the AVFoundation.AVCaptureMetadataOutput has been added to the AVCaptureSession.Outputs of a AVFoundation.AVCaptureSession object, as shown in the following code:

C# Example

session = new AVCaptureSession();
var camera = AVCaptureDevice.DefaultDeviceWithMediaType(AVMediaType.Video);
var input = AVCaptureDeviceInput.FromDevice(camera);

//Add the metadata output channel
metadataOutput = new AVCaptureMetadataOutput();
var metadataDelegate = new MyMetadataOutputDelegate();
metadataOutput.SetDelegate(metadataDelegate, DispatchQueue.MainQueue);
session.AddOutput(metadataOutput);

//Confusing! *After* adding to session, tell output what to recognize...
metadataOutput.MetadataObjectTypes = new NSString[] {
	AVMetadataObject.TypeQRCode,
	AVMetadataObject.TypeEAN13Code
};

session.StartRunning();
          

Related content

Requirements

Namespace: AVFoundation
Assembly: Xamarin.iOS (in Xamarin.iOS.dll)
Assembly Versions: 0.0.0.0