See Also: AVMetadataMachineReadableCodeObject Members
The following barcode types can be natively recognized in iOS 7:
Barcode type | Constant for use with AVMetadataOutput.MetadataObjectType |
---|---|
Aztec | AVMetadataObject.TypeAztecCode |
Code 39 | AVMetadataObject.TypeCode39Code |
Code 39 mod 43 | AVMetadataObject.TypeCode39Mod43Code |
Code 93 | AVMetadataObject.TypeCode93Code |
Code 128 | AVMetadataObject.TypeCode128Code |
PDF417 | AVMetadataObject.TypeCodePDC417Code |
QR | AVMetadataObject.TypeQRCode |
UPC-E | AVMetadataObject.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();