条形码扫描不包括AVmetadaTypeFace

时间:2016-11-15 14:15:14

标签: ios barcode metadatatype

我正在使用AVFoundation开发条形码扫描仪应用程序。我的应用程序成功捕获条形码数据,但在检测到FaceObjectType时崩溃。我们如何排除这种类型以防止崩溃?

我正在使用此

captureMetadataOutput.metadataObjectTypes = [captureMetadataOutput availableMetadataObjectTypes];

任何帮助都非常感谢!感谢

3 个答案:

答案 0 :(得分:0)

它有点晚了,但我认为它会帮助那些有同样问题的人。 对于防止崩溃,你需要处理AVMetadataObject(https://developer.apple.com/documentation/avfoundation/avmetadataobject),所以我的建议如下(swift 3.0)

for metadataObject in metadataObjects {
     if (metadataObject as AnyObject).type == AVMetadataObjectTypeFace {
                return
            }
        }

答案 1 :(得分:0)

您将使用此

修复支持的对象类型
  NSArray *supportedType =[NSArray arrayWithObjects:
                         AVMetadataObjectTypeCode39Code,
                         AVMetadataObjectTypeCode39Mod43Code,
                         AVMetadataObjectTypeCode93Code,
                         AVMetadataObjectTypeCode128Code,
                         AVMetadataObjectTypeEAN8Code,
                         AVMetadataObjectTypeEAN13Code,
                         AVMetadataObjectTypeAztecCode,
                         AVMetadataObjectTypePDF417Code,
                         AVMetadataObjectTypeQRCode, nil];

captureMetadataOutput.metadataObjectTypes = supportedType;

而不是

captureMetadataOutput.metadataObjectTypes = [captureMetadataOutput availableMetadataObjectTypes];

这会有所帮助。

答案 2 :(得分:0)

相关问题