启动GMVDetector失败

jdn*_*ity 5 swift google-ios-vision

我使用以下代码在我的Swift 3.1项目中使用GoogleMobileVision/Barcode检测器:

GMVDetector(ofType: GMVDetectorTypeBarcode, options: nil)
Run Code Online (Sandbox Code Playgroud)

但在日志中显示:

日志

似乎iOS中的GoogleMobileVision是封闭源代码,所以我无法真正看到实现方面发生了什么

关于这里可能发生什么的任何想法?

Mah*_*san 2

我认为您需要输入一些条形码类型的可选值,例如 EAN13 或 QRcode,而不是 nil。

var detector = GMVDetector()
let options:[AnyHashable: Any] = [GMVDetectorBarcodeFormats : GMVDetectorBarcodeFormat.EAN13.rawValue]
self.detector = GMVDetector.init(ofType: GMVDetectorTypeBarcode, options: options) 
Run Code Online (Sandbox Code Playgroud)