相关疑难解决方法(0)

适用于iOS 11的Vision Framework条形码检测

我一直在实施Apple在WWDC2017中引入的新Vision框架的测试.我特别关注条形码检测 - 我从相机/图库扫描图像后得知这是条形码图像.但是,在查看barcodeDescriptor时,我无法看到实际的条形码值或有效负载数据.https://developer.apple.com/documentation/coreimage/cibarcodedescriptor页面上似乎没有任何内容可以识别任何属性.

我收到这些错误:

  • 无法连接到远程服务:错误域= NSCocoaErrorDomain代码= 4097"连接到名为
    com.apple.BarcodeSupport.BarcodeNotificationService的服务"
  • libMobileGestalt MobileGestalt.c:555:无法访问InverseDeviceID(请参阅问题/ 11744455>)
  • 连接到名为com.apple.BarcodeSupport.BarcodeNotificationService的服务错误
    域= NSCocoaErrorDomain代码= 4097

有没有办法从VNBarcodeObservation访问条形码值?任何帮助将不胜感激.谢谢!这是我正在使用的代码:

@IBAction func chooseImage(_ sender: Any) {
        imagePicker.allowsEditing = true
        imagePicker.sourceType = .photoLibrary

        present(imagePicker, animated: true, completion: nil)
    }

    @IBAction func takePicture(_ sender: Any) {
        if(UIImagePickerController .isSourceTypeAvailable(UIImagePickerControllerSourceType.camera)){
            imagePicker.sourceType = UIImagePickerControllerSourceType.camera
            self .present(imagePicker, animated: true, completion: nil)
        }
        else{
            let alert = UIAlertController(title: "Warning", message: "Camera not available", preferredStyle: UIAlertControllerStyle.alert)
            alert.addAction(UIAlertAction(title: "Dismiss", style: UIAlertActionStyle.default, handler: nil))
            self.present(alert, animated: true, completion: nil)
        }
    }

    //PickerView …
Run Code Online (Sandbox Code Playgroud)

barcode swift4 ios11 xcode9-beta apple-vision

7
推荐指数
2
解决办法
4418
查看次数

标签 统计

apple-vision ×1

barcode ×1

ios11 ×1

swift4 ×1

xcode9-beta ×1