瀏覽代碼

start qr-code-reader in background as adviced by logged system warning

the warning reads sth as
"[AVCaptureSession startRunning] should be called from background thread.
Calling it on the main thread can lead to UI unresponsiveness"

closes #1836
B. Petersen 2 年之前
父節點
當前提交
2ba04bfad8
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      deltachat-ios/Controller/QrCodeReaderController.swift

+ 4 - 2
deltachat-ios/Controller/QrCodeReaderController.swift

@@ -174,9 +174,11 @@ class QrCodeReaderController: UIViewController {
     // MARK: - actions
     func startSession() {
         #if targetEnvironment(simulator)
-        // ignore if run from simulator
+            // ignore if run from simulator
         #else
-        captureSession.startRunning()
+            DispatchQueue.global(qos: .userInteractive).async {
+                self.captureSession.startRunning()
+            }
         #endif
     }