我遇到错误:
尚不支持CIDataMatrixCodeDescriptor类型的key inputBarcodeDescriptor的值
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)
答案 0 :(得分:0)
好吧,我认为您应该相信此运行时警告。您不能使用CIDataMatrixCodeDescriptor创建条形码。该类已记录在案,但实际上没有用。请改用其他CIBarcodeDescriptor子类(例如CIAztecCodeDescriptor)。