Search code examples
swiftavfoundationqr-codedatamatrix

Reading DataMatrix with AVFoundation


This works with standard QR Codes, but however not with a Data Matrix like here.


Solution

  • The reason for this is, that your example doesn't scan for Data Matrix. It only scans for AVMetadataObjectTypeQRCode, AVMetadataObjectTypeEAN8Code, AVMetadataObjectTypeEAN13Code and AVMetadataObjectTypePDF417Code. It should work, if you add AVMetadataObjectTypeDataMatrixCode to the metadataOutput.metadataObjectTypes-array.

    Here you find a list of the machine readable object types you can scan for with AVFoudation.