- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要使用 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/
我正在尝试在我的 iOS 应用程序中实现条形码扫描,但由于某种原因我无法打开相机。我正在使用 Apple 的 AVFoundation 框架进行扫描。 这是我启动相机和实现扫描仪的代码: // Get
我在检测二维码在哪里时遇到问题。 我需要在它周围画边框。 我使用 AVMetadataObject 贝塞尔曲线路径,但它不起作用。 请帮助我。 - (void)captureOutput:(AVCap
一段时间以来,我一直在发布一个应用程序,该应用程序使用 AVFoundation Framwork 读取驾照上的 PDF417 条形码以捕获数据。适用于许多不同州的驾驶执照。但是,我无法让它读取马里兰
我想将 iOS 7 的新条形码扫描功能与 UIImage 一起使用,而不是从设备的相机之一进行实时捕获。我已经使用 AVCaptureDeviceInput 进行检测。 我认为最好的方法是创建一个 A
我需要使用 iOS 设备上的相机扫描 MicroQR 条形码。有谁知道添加类型的 native 方法?例如,我的内置常量如下所示:哦,是的,我正在使用 Swift let supportedCodeT
我是 Swift/iOS 开发的新手,正在致力于将 Swift 3.0 项目转换为 Swift 4.2 以支持更新的设备。 在这个过程中,我收到以下错误: Cannot assign value of
我是一名优秀的程序员,十分优秀!