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.