如何扫描QR码并将PDF存储在iOS应用程序中

时间:2017-05-02 10:26:17

标签: ios swift3

尝试过很多事情。但是我仍然无法从QR码中检索存储的PDF。当我扫描代码时,我得到了url输出。

 func captureOutput(_ captureOutput: AVCaptureOutput!, didOutputMetadataObjects metadataObjects: [Any]!, from connection:   AVCaptureConnection!) {
        if metadataObjects == nil || metadataObjects.count == 0 {
            qrCodeFrameView?.frame = CGRect.zero
            messageLabel.text = "No barcode/QR code is detected"
            return
        }
        let metadataObj = metadataObjects[0] as!     AVMetadataMachineReadableCodeObject

        if supportedBarCodes.contains(metadataObj.type) {
//        if metadataObj.type == AVMetadataObjectTypeQRCode {
            let barCodeObject = videoPreviewLayer?.transformedMetadataObject(for: metadataObj)
            qrCodeFrameView?.frame = barCodeObject!.bounds
    }
  }
}

0 个答案:

没有答案