2

I am getting error:

Value for key inputBarcodeDescriptor of type CIDataMatrixCodeDescriptor is not yet supported

let string = "tempValue&123"
let data = string.data(using: String.Encoding.ascii, allowLossyConversion: false)
guard let data = data else {
    return nil
}

let descriptor = CIDataMatrixCodeDescriptor(payload: data, rowCount: 1, columnCount: 1, eccVersion: CIDataMatrixCodeDescriptor.ECCVersion(rawValue: 0))        
let inputParameter  = ["inputBarcodeDescriptor": descriptor]        
let datafilter = CIFilter(name: "CIBarcodeGenerator", parameters: inputParameter)        
let image = datafilter?.outputImage        
print(image)
rmaddy
  • 314,917
  • 42
  • 532
  • 579
Ashim Dahal
  • 1,097
  • 13
  • 15

2 Answers2

2

Well, I think you should just believe this runtime warning. You can't create a barcode using a CIDataMatrixCodeDescriptor; the class is documented but it isn't actually working. Use a different CIBarcodeDescriptor subclass instead (such as CIAztecCodeDescriptor).

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • There are third-party libraries that can make a data matrix. See https://stackoverflow.com/questions/51311257/present-a-datamatrix-in-ios for suggestions. – matt Dec 14 '18 at 05:35
1

wow, I've just ran into this issue... in 2022 :D

message is still [api] Value for key inputBarcodeDescriptor of type CIDataMatrixCodeDescriptor is not yet supported

so I filed a feedback, let's hope for the best, as there's no lightweight alternative to generate DataMatrix codes that I could find

szilagyilev
  • 143
  • 7