From d2d1ca96429068afea41740a03660d6a31246ce2 Mon Sep 17 00:00:00 2001 From: Hank Date: Thu, 29 Sep 2022 14:08:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=94=E8=AF=A5=E5=9C=A8=E5=AD=90=E7=BA=BF?= =?UTF-8?q?=E7=A8=8B=E5=90=AF=E5=8A=A8=E6=88=96=E5=81=9C=E6=AD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Call this method to start the flow of data from the capture session’s inputs to its outputs. This method is synchronous and blocks until the session starts running or it fails, which it reports by posting an AVCaptureSessionRuntimeError notification. --- Source/LBXScanWrapper.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/LBXScanWrapper.swift b/Source/LBXScanWrapper.swift index 126441c..609bd51 100755 --- a/Source/LBXScanWrapper.swift +++ b/Source/LBXScanWrapper.swift @@ -150,14 +150,18 @@ open class LBXScanWrapper: NSObject,AVCaptureMetadataOutputObjectsDelegate { func start() { if !session.isRunning { isNeedScanResult = true - session.startRunning() + DispatchQueue.global().async { + self.session.startRunning() + } } } func stop() { if session.isRunning { isNeedScanResult = false - session.stopRunning() + DispatchQueue.global().async { + self.session.stopRunning() + } } }