gpt4 book ai didi

ios - 有没有办法将 MicroQR 条形码添加为 AVMetadataObject.ObjectType?

转载 作者:行者123 更新时间:2023-11-30 11:02:10 26 4
gpt4 key购买 nike

我需要使用 iOS 设备上的相机扫描 MicroQR 条形码。有谁知道添加类型的 native 方法?例如,我的内置常量如下所示:哦,是的,我正在使用 Swift

let supportedCodeTypes = [AVMetadataObject.ObjectType.upce, AVMetadataObject.ObjectType.code39,
AVMetadataObject.ObjectType.code39Mod43, AVMetadataObject.ObjectType.code93,
AVMetadataObject.ObjectType.code128, AVMetadataObject.ObjectType.ean8,
AVMetadataObject.ObjectType.ean13, AVMetadataObject.ObjectType.aztec,
AVMetadataObject.ObjectType.pdf417, AVMetadataObject.ObjectType.itf14,
AVMetadataObject.ObjectType.dataMatrix, AVMetadataObject.ObjectType.interleaved2of5,
AVMetadataObject.ObjectType.qr]

我想我可以这样实现它:

 let microqr = AVMetadataObject.ObjectType(rawValue: String)

然后我就可以将它添加到我的数组中,但我不知道将什么作为 rawValue: 的字符串放置。当然,我什至不确定这是否有效。我真的很感激朝正确方向的插入。谢谢

最佳答案

否 - AVCaptureMetadataOutput 的识别引擎位于系统软件或硬件中,Apple 不提供用于插入您自己的新对象类型引擎的 API。

您是正确的,可以使用 init(rawValue: String) 初始值设定项和任何任意字符串构造 AVMetadataObject.ObjectType 类型的值。但是,AVCapture 系统只能作用于它知道的对象类型 - AVMetadataObject.ObjectType 类型的其他值对于使用该类型的 API 来说毫无意义。 (我不确定未知的 ObjectType 值是否会被此类 API 忽略或引发错误,但很容易检查...)

换句话说,调用 AVMetadataObject.ObjectType(rawValue: "someNewBarcodeStandard") 并不比 AVMetadataObject.ObjectType(rawValue: "🐟") 教它如何识别鱼。

顺便说一句,Swift 类型推断意味着您不必写出每个类型/常量名称:

let supportedCodeTypes: [AVMetadataObject.ObjectType] = [.upce, .code39,
.code39Mod43, .code93,
.code128, .ean8,
.ean13, .aztec,
.pdf417, .itf14,
.dataMatrix, .interleaved2of5,
.qr]

关于ios - 有没有办法将 MicroQR 条形码添加为 AVMetadataObject.ObjectType?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53215759/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com