我可以通过二维条码图像获取字符串信息,并通过输入字符串生成二维条码图像,但是如何通过一维条码获取字符串消息以及如何使用字符串生成字符串消息?下面的代码是关于二维条码的:
+ (NSString *)decodeImage:(CIImage *)ciImage {
NSDictionary *options = @{CIDetectorAccuracy : CIDetectorAccuracyHigh};
CIDetector *detector = [CIDetector detectorOfType:CIDetectorTypeQRCode context:nil options:options];
NSArray *features = [detector featuresInImage:ciImage];
for (CIFeature *feature in features) {
if ([feature isKindOfClass:[CIQRCodeFeature class]]) {
CIQRCodeFeature *qrFeature = (CIQRCodeFeature *)feature;
return qrFeature.messageString;
}
}
return nil;
}
....一维条形码怎么样?
发布于 2017-02-22 15:54:32
您使用的系统无法检测到您想要的条形码类型。
但是有一个不同的系统可以用来检测更多种类的代码。查看AVCaptureSession中使用的AVCaptureMetadataOutput。
有关其工作原理的摘要,请参阅https://ayeohyes.wordpress.com/2015/05/09/barcode-scanning-in-ios-using-avfoundation/
https://stackoverflow.com/questions/42384248
复制相似问题